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>