Disable Browser Back Buttton Functionality

Normally we have the tendency to move back and forth within the web-browser.
However in the mission critical environment we just seem to be fooled.Once I was
juts browsing through my CITIBANK account and tried to just push through the back button of the browser. the hell it was to do so AS I was immediately logged out.


So you need to know the simple though highly useful trick to just make your web-projects capable of delivering such efficiency in the mission critical environments.

Herein I chip with the simple javascript code that shall add up this functionality.
So that when you are on a web page and via server.transfer or response.redirect you get redirected to suppose webpage2.aspx from the webpage1.aspx, you can't access the former page that is (webpage1) by using the back button of your web browser - as you are on webpage1.aspx currently.

The head section of the web page must be accompanied with this code-sniffet.
REPLACE /* WITH ANGULAR BRACKETS...

/* script type = "text/javascript" */

function preventBack()
{
window.history.forward();
}

setTimeout("preventBack()", 0);

window.onunload=function(){null};

/* /script */

Post a Comment

Previous Post Next Post