I am writing an application that if the user hits back, it may resend the same information and mess up the flow and integrity of data. How do I disable it for users who are with and without javascript on?
相关问题
- TestCafe - The browser always starts in clean slat
- UrlEncodeUnicode and browser navigation errors
- Character Encoding in iframes
- How to load local *.htm file to WPF WebBroswer wit
- Selenium newer Chrome cannot disable browser notif
相关文章
-
Is it bad to put elements within the <hea
- Calling Chrome web browser from the webbrowser.get
- How can a browser know the scss files?
- Is there a way to specify minimum and maximum zoom
- How to invoke phone dialer in browser? or is it im
- Can't detect Android in web server
- Android browser scaling?
- Form being randomly submitted as GET instead of PO
查看全部
Here's a previous post on it: Prevent Use of the Back Button (in IE)
I came up with a little hack that disables the back button using JavaScript. I checked it on chrome 10, firefox 3.6 and IE9:
It's not possible, sadly. However, consider your applications navigation model. Are you using Post/Redirect/Get PRG Model? http://en.wikipedia.org/wiki/Post/Redirect/Get?
This model is more back button friendly than the Postback model.
You shouldn't.
You could attach some script to the onbeforeunload event of a page and confirm with the user that's what they want to do; and you can go a bit further and try to disable it but of course that will only work for users who have javascript turned on. Instead look at rewriting the app so you don't commit transactions on each page submit, but only at the end of the process.
I strongly urge you to go to heroic lengths to prevent breaking the back button, it is a sure fire way to alienate your users and even made it to No.1 on Jacob Neilsen's Top 10 Web Design Mistakes in 1999.
Perhaps you could consider rather asking the question: "How to avoid breaking the back button for <insert your scenario here>?"
If Scott's answer hits close to the mark, consider changing your flow to the PRG model. If it's something else, then give a bit more detail and see how we can help.
Find below link
Disable browser back button functionality using JavaScript in asp.net | ASP.Net disable browser back button (using javascript)
http://www.aspdotnet-suresh.com/2011/11/disable-browser-back-button.html