How to disable both Back and Forward Browser buttons?

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

Write only one line of code in below Javascript function:-
<script type="text/javascript" language="javascript">

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

<body onload="disable_browser_buttons();">

Note:- But i would not suggest you to use this JavaScript,Because if the JavaScript is Disable
in the Browser,then above code will not work.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response