This Function adds # and 1 to window location in a very short period, fraction of second so that There is no Previous page Other than same page for back space of browser back event.
So it does not actually disables the back event but makes the page behave like that.
//disable back button of web-Browser
function changeHashOnLoad() {
window.location.href += "#";
setTimeout("changeHashAgain()", "50");
}
function changeHashAgain() {
window.location.href += "1";
}
var storedHash = window.location.hash;
window.setInterval(function () {
if (window.location.hash != storedHash) {
window.location.hash = storedHash;
}
}, 50);
changeHashOnLoad();
So it does not actually disables the back event but makes the page behave like that.
//disable back button of web-Browser
function changeHashOnLoad() {
window.location.href += "#";
setTimeout("changeHashAgain()", "50");
}
function changeHashAgain() {
window.location.href += "1";
}
var storedHash = window.location.hash;
window.setInterval(function () {
if (window.location.hash != storedHash) {
window.location.hash = storedHash;
}
}, 50);
changeHashOnLoad();