How to disable browser's Back button?

 Posted by vishalneeraj-24503 on 7/2/2014 | Category: JavaScript Interview questions | Views: 1114 | Points: 40
Answer:

We have to write only one line of code in below Javascript function to disable back button of browser:-
<script type="text/javascript" language="javascript">

function disable_browser_back_button()
{
window.history.forward();
}
</script>

And call above function on Body Onload event as
<body onload="disable_browser_back_button();">


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response