Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable browser "back" button [duplicate]

Possible Duplicate:
Disable browser's back button

How can I disable a browsers back button, in an asp.net mvc project. Can I use java script for this ? or is there any other ways to do this ?

like image 859
SRA Avatar asked Apr 10 '26 12:04

SRA


2 Answers

This has often been discussed on countless threads, the most exhaustive article is here and why it always will not work.

like image 104
Ta01 Avatar answered Apr 12 '26 01:04

Ta01


A website should not try to cripple the browser, but instead should work inside the browser-page system of the web. There are good reason for not wanting the user to click back (re-POSTing data, especially financial transactions and the like), but rather than forcing them not to, your website should handle these gracefully. Using a good framework like .NET leaves you a lot of great options for keeping your site stateful even amid the stateless web. Write your code to fit the browser, don't make the browser fit your code (like the ridiculous no-right-click javascripts of yesteryear).

That said, thankfully there is no way to do this, and even if there were, it could always be disabled on the client side.

like image 36
Chet Avatar answered Apr 12 '26 01:04

Chet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!