I would like to Disable Back button when user click on logoff for this i delete only cookies of that user not session in my application. And want to disable Back button
if(getCookie('username') == ""){
Disable back button;// we use "window.history.redirect" for javascript i look jquery for this
}
Please help me..
you must push your url in pushState and clean the browser history:
try this :
$(document).ready(function() {
window.history.pushState(null, "", window.location.href);
window.onpopstate = function() {
window.history.pushState(null, "", window.location.href);
};
});
Use following code as it is:
window.onload = function () {
if (typeof history.pushState === "function") {
history.pushState("jibberish", null, null);
window.onpopstate = function () {
history.pushState('newjibberish', null, null);
};
}
else {
var ignoreHashChange = true;
window.onhashchange = function () {
if (!ignoreHashChange) {
ignoreHashChange = true;
window.location.hash = Math.random();
}
else {
ignoreHashChange = false;
}
};
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With