-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.

user3595072
  • 57
  • 2
  • 11
  • 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. – fahadash Jul 01 '14 at 06:02
  • Change your approach. If a user goes back for a currently saved "thing", you gotta be aware of that. – celerno Jul 01 '14 at 06:06
  • history.pushState(null, null, 'no-back-button'); window.addEventListener('popstate', function(event) { history.pushState(null, null, 'no-back-button'); }); – user3595072 Jul 01 '14 at 10:10
  • the above code persist the state of my page..with out disabling the back button.. – user3595072 Jul 01 '14 at 10:10

1 Answers1

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)