Prevent Use of the Back Button (in IE)

前端 未结 15 1916
囚心锁ツ
囚心锁ツ 2020-11-27 21:16

So the SMEs at my current place of employment want to try and disable the back button for certain pages. We have a page where the user makes some selections and submits the

相关标签:
15条回答
  • 2020-11-27 21:53

    What the users have figured out is that they don't have to enter a comment if they submit the information and go to the page with the comment and then hit the back button to return to the previous page.

    Then they are probably also smart enough to type 'no comment' into the comments field.

    You can try to force people to add comments, but you will probably just end up with bad unusable software, annoyed users, and still not get comments. This is usually a good time to take a step back and reconsider what you are doing from the users' point of view.

    0 讨论(0)
  • 2020-11-27 21:54

    You can prevent them from going back to the previous page. location.replace() replaces the current page's history entry with a new page, so...

    page1.html: user clicks a link that goes to page2.html

    page2.html: user clicks a link that calls location.replace('page3.html');

    page3.html: user clicks back button and goes to page1.html

    This may not fit well with doing a POST, but you could post the data to a web service via AJAX, then call location.replace()

    0 讨论(0)
  • 2020-11-27 21:55

    AS a simple solution: try this one. Insert an update panel and a button in there and use javascript to hide it and then press it on page load. Yes I understand that it will cause your page to post back on load and may not work if javascript is disabled but certainly will help you achieve a half decent response to the back button issue. Andy

    0 讨论(0)
提交回复
热议问题