How to disable browser refresh button in Lectora?
December 10, 2013 12:00 AM
Hello. I have lectora publisher. In lectora, there is same URL for every page in the course. So, if a user refresh the page, it will go to the first page of the course. I don't want this, So, I want to disable the refresh option in Lectora copurses. How can I do this? Also, If user wants to refresh, then I have put a refresh button in lectora itself, not in browser and by some javascript, user can refresh the same page by using button I provided in Lectora. But issue is with browser's refresh. Is there any way I can achieve this? Or any other way to prevent this issue?
Discussion (1)
Maybe it is too late for you, but just in case you haven't figured out a solution yet.
Disabling browser refresh:
//this code handles the F5/Ctrl+F5/Ctrl+R
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event)
keycode = window.event.keyCode;
else if (e)
keycode = e.which;
// Mozilla firefox
if ($.browser.mozilla) {
if (keycode == 116 ||(e.ctrlKey undefined keycode == 82)) {
if (e.preventDefault)
{
e.preventDefault();
e.stopPropagation();
}
}
}
// IE
else if ($.browser.msie) {
if (keycode == 116 || (window.event.ctrlKey undefined keycode == 82)) {
window.event.returnValue = false;
window.event.keyCode = 0;
window.status = "Refresh is disabled";
}
}
}
[/CODE]
[B][I]Disabling right click:[/I][/B]
[CODE]
var bodyTag = document.getElementsByTagName("body");
bodyTag[0].setAttribute("oncontextmenu","return false;");
[/CODE][CODE]
//this code handles the F5/Ctrl+F5/Ctrl+R
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event)
keycode = window.event.keyCode;
else if (e)
keycode = e.which;
// Mozilla firefox
if ($.browser.mozilla) {
if (keycode == 116 ||(e.ctrlKey undefined keycode == 82)) {
if (e.preventDefault)
{
e.preventDefault();
e.stopPropagation();
}
}
}
// IE
else if ($.browser.msie) {
if (keycode == 116 || (window.event.ctrlKey undefined keycode == 82)) {
window.event.returnValue = false;
window.event.keyCode = 0;
window.status = "Refresh is disabled";
}
}
}
[/CODE]
Disabling right click:
var bodyTag = document.getElementsByTagName("body");
bodyTag[0].setAttribute("oncontextmenu","return false;");
[/CODE][CODE]
var bodyTag = document.getElementsByTagName("body");
bodyTag[0].setAttribute("oncontextmenu","return false;");
[/CODE]
Discussions have been disabled for this post