How To Disable Back function in browser?

Disable Back function in browser

Sometimes we need to disable back function of our web page.
So, I am giving the code To disable back function. just write below javascript code in your head tag.

Code :

<script type = "text/javascript" >
function disableBackButton()
setTimeout("disableBackButton()", 0);

Then put the below in body tag.


<body onload="disableBackButton()">

Thank You.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: