How can i disable browser from going back to a particular page? My scenario is Login page -> change password page ->user returns to login page again-> (on browser back should not go back to chang开发者_开发问答e password page) but currently it goes to the change password page. I am currently working on a grails application. How can i solve this issue?
You can't stop users from going back if they want to, because a browser can do whatever it feels like.
But if you only want to prevent users from going back accidentally, then just make the "change password" page only appear in response to an HTTP POST (not just a URL link, which is an HTTP GET request). Most browsers will give a warning about re-submitting the form if the previous page was the result of a POST request.
Use javascript's location.replace() function:
http://www.roseindia.net/javascript/javascript-location-replace.shtml
精彩评论