Pages

Tuesday 8 November 2011

Preventing the use of backbutton in asp.net

We can use the javascript code below  to prevent the use of backbutton in asp.net webpages.


<script type="text/javascript">
function noBack(){window.history.forward();}
noBack();
window.onload=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack();}
window.onunload=function(){void(0);}
</script>






1 comment:

  1. i have been searching google from so many days,a page full of codes, none of the code worked properly.

    but this few lines of code worked buddy......

    thanks :-)

    ReplyDelete