disable back button of IExplorer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shashi shekhar singh
    New Member
    • Aug 2009
    • 30

    disable back button of IExplorer

    Respected Sir,
    I am currently facing a problem in disabling the back Button of IExplorer.
    Actually I have taken two UpdatePanel on the page(Page A).
    At first when Page(Page A ) loads then Update Panel 1 Contents is showing it includes Textboxes, Timer and button(Start), On Clicking that Button (Start Button) Update Panel2 loads contains gridview. After this Button(Start ) .visible =false;
    Now when Update Panel 2 has been loaded then I want that IExplorer Back Button should be disabled or can'nt go back from this current page state when Update Panel 1 and Update Panel 2 Both loads.
    When I am using window.history. forward(1) on Prerender or in <script> Block then Update Panel 2 data have been lost and only Update Panel 1 data has been shown (as displayed when Page A loads first time), therefore i am expecting some help from you , this is really urgent for me. if u have other idea that would be better for me.
    I also used window.onbeforu nload event and it works good when IExplorer Back Button has been clicked (It alerts to show that there is some unsaved data and when click cancel then page status or remain same ) but when I clicked OK then it will process same as above.
    So please help me out.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Please post new questions in a thread of their own.
    I've split your question off: displaying file names aspx page. Since this is not an ASP.NET question I've moved the question to the JavaScript forum.

    Disabling the back button is never a good idea.
    When the user leaves the page then they may no longer have access to their browser's back button which isn't fair.

    Instead of disabling the back button I recommend you add a JavaScript method that handles the window.onbefore unload event. The onbeforeunload event happens just before the page is unloaded (full page post backs will cause the page to unload). If the method that handles the event returns anything then a message box is displayed asking the user if they want to continue or cancel.

    I'm not sure why you are flipping through the user's history..this is a little weird. I would let the user leave the page if they want to leave the page. If they say "yes I want to leave the page" when the onbeforeunload message appears, then you should let them go.

    -Frinny

    Comment

    Working...