Can I disable BACK button of brower RRS feed

  • Question

  • Fri, Mar 09 2012 06:16 PM|LINK

    I have a requirment to disable BACK button of browser.  

    I have tried following options:

    1.  Used following Javascript to redirect on the same page again.

    <script type="text/javascript">


       function noBack() { window.history.forward(); }


    <body onload="noBack();" onunload="">

             But in this case we loose the data on the current page

    2.  open child webpage in new window.  

             But in this case popup Blocker blocks the page to display


    Can any expert help me a better solution/idea.....


    • Moved by Neddy Ren Wednesday, March 14, 2012 7:56 AM asp.net issue (From:Visual C# General)
    Monday, March 12, 2012 11:04 AM

All replies

  • Try setting these HTTP headers (or adding a meta http-equiv tag to the page header):

    • cache-control=no-cache to instruct the browser to not cache
    • pragma=no-cache to instruct the browser to not use cached content, if any exists
    • expires=0 to intruct the browser that the content expires now

    That doesn't prevent back, but prevents access to the content.

    Paulo Morgado

    Monday, March 12, 2012 11:49 AM
  • Hi Tayyab Rashid,

    You will need to post your questions to the http://forums.asp.net forum for your questions are the asp.net web issue.

    I will help and move your thread to the off-topic forum.

    Thank you for understandings.

    Best Regards

    Neddy Ren[MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, March 14, 2012 7:56 AM