Reputation: 18963
how to disable browser back button that works for all major browsers: IE/FF/ Chrome/Opera/Safari.
thanks!
Upvotes: 1
Views: 3112
Reputation: 9942
You can try below script which is working code, put this code on your web page(.aspx).
<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>
Happy coding !!
Upvotes: 0
Reputation: 3156
Use history.forward(); in your source page from where you are going to the target page.now if u try to go back to the previous page u can't.
<script type="text/javascript" language="javascript">
history.forward();
</script>
disabling the browser button is not possible but try this solution if u want to implement in the same way.
Upvotes: 0
Reputation: 2156
It is not possible to disable the browser back button. There are couple of work arounds:
Upvotes: 2
Reputation: 6077
It's is technically impossible to disable the back button, but maybe this will help you out. It shows you some 'tricks' to achieve the same functionality.
But you can also use AJAX and load everything asynchronous (so the user will always be on the same single page)
Upvotes: 1