-4

I need to disable my browser back button for an money transfer application.. once the final deal confirmation is reached then the back button should be disabled.. Here is my code where i use scripts..I goggled some examples which were places in tags but its doesn't work for me..

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> <style type="text/css"> </style> <script type="text/javascript"> </script> </asp:Content> 

please suggest good solution to over come this issue..
Thank-You.

4
  • 2
    You can't control what client software can do through your web application unless client software allows you... Best is to do state management and handle the details on server side. Commented Jul 1, 2014 at 6:02
  • Change your approach. If a user goes back for a currently saved "thing", you gotta be aware of that. Commented Jul 1, 2014 at 6:06
  • history.pushState(null, null, 'no-back-button'); window.addEventListener('popstate', function(event) { history.pushState(null, null, 'no-back-button'); }); Commented Jul 1, 2014 at 10:10
  • the above code persist the state of my page..with out disabling the back button.. Commented Jul 1, 2014 at 10:10

1 Answer 1

0

You need to force the cache to expire for this to work. Place the following code on your page code behind.

Page.Response.Cache.SetCacheability(HttpCacheability.NoCache) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.