Browser back button

Discussion in 'Javascript' started by ns21, Aug 8, 2006.

  1. ns21

    ns21 Guest

    How can the browser back button be disabled If the form is submitting
    information to other pages or submitting to itself or using
    redirections.

    I tried the tweaks like history.forward(1) in each page to prevent user
    to navigate back but its not very effective.

    The server side scripting is done using ASP.

    you may ask that why at first place I want to disable the browser back
    button, this is due to the following issue
    http://groups.google.co.in/group/aspnet/browse_thread/thread/77a38b4635b32b88

    In absence of response from responsible MVPs, I decided to provide a
    back button in the application that use redirection mechanisms but
    since user always has back button on browser, it makes the application
    error-prone.

    Thanks,
    ns21, Aug 8, 2006
    #1
    1. Advertising

  2. ns21

    Randy Webb Guest

    ns21 said the following on 8/8/2006 2:46 AM:
    > How can the browser back button be disabled


    Make sure there is no other page opened first. Otherwise, it can't be
    disabled.

    > If the form is submitting information to other pages or
    > submitting to itself or using redirections.


    Whether it is submitting information to another page, itself, to
    nowhere, using redirects, is all irrelevant. You can't disable the back
    button if the browser enables it.


    > I tried the tweaks like history.forward(1) in each page to prevent user
    > to navigate back but its not very effective.


    It's not a "tweak", its a .001% effective hack is all.

    > The server side scripting is done using ASP.


    ASP, PHP, PERL, it's irrelevant what server side language is used to
    generate what the browser deals with.

    > you may ask that why at first place I want to disable the browser back
    > button, this is due to the following issue
    > http://groups.google.co.in/group/aspnet/browse_thread/thread/77a38b4635b32b88


    Fix your back end and stop trying to fix the wrong problem. Your server
    side code should be able to handle *anything* the client does - and -
    recover from it without client side hacks to prop it up.

    > In absence of response from responsible MVPs,


    I only know 1 responsible MVP.

    > I decided to provide a back button in the application that use
    > redirection mechanisms but since user always has back button on
    > browser, it makes the application error-prone.


    If the Back button breaks your app, it was error-prone before the Back
    button was discovered.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Aug 8, 2006
    #2
    1. Advertising

  3. ns21

    ns21 Guest

    Thanks Randy for quick reply,

    You are right that I could be in wrong direction to fix the wrong
    problem.

    But the issue, which I am facing is the originator of the wrong
    approach.
    The issue mentioned in this thread
    http://groups.google.co.in/group/aspnet/browse_thread/thread/77a38b4635b32b88

    This is really not specific to ASP, its rather a browser level issue
    but since I was working on ASP I posted that into ASP forum.

    I have posted very small code in the thread above that helps simulating
    the issue, I am not using any backend operations... the page is only
    displaying date time from the server.
    The REAL requirement is to make sure that page get fresh copy from the
    server and on hitting back button it should not through Page can not be
    displayed error.

    Can you pls help?



    Randy Webb wrote:

    > ns21 said the following on 8/8/2006 2:46 AM:
    > > How can the browser back button be disabled

    >
    > Make sure there is no other page opened first. Otherwise, it can't be
    > disabled.
    >
    > > If the form is submitting information to other pages or
    > > submitting to itself or using redirections.

    >
    > Whether it is submitting information to another page, itself, to
    > nowhere, using redirects, is all irrelevant. You can't disable the back
    > button if the browser enables it.
    >
    >
    > > I tried the tweaks like history.forward(1) in each page to prevent user
    > > to navigate back but its not very effective.

    >
    > It's not a "tweak", its a .001% effective hack is all.
    >
    > > The server side scripting is done using ASP.

    >
    > ASP, PHP, PERL, it's irrelevant what server side language is used to
    > generate what the browser deals with.
    >
    > > you may ask that why at first place I want to disable the browser back
    > > button, this is due to the following issue
    > > http://groups.google.co.in/group/aspnet/browse_thread/thread/77a38b4635b32b88

    >
    > Fix your back end and stop trying to fix the wrong problem. Your server
    > side code should be able to handle *anything* the client does - and -
    > recover from it without client side hacks to prop it up.
    >
    > > In absence of response from responsible MVPs,

    >
    > I only know 1 responsible MVP.
    >
    > > I decided to provide a back button in the application that use
    > > redirection mechanisms but since user always has back button on
    > > browser, it makes the application error-prone.

    >
    > If the Back button breaks your app, it was error-prone before the Back
    > button was discovered.
    >
    > --
    > Randy
    > comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    > Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    ns21, Aug 8, 2006
    #3
  4. ns21 wrote:

    > How can the browser back button be disabled If the form is submitting
    > information to other pages or submitting to itself or using
    > redirections.


    The standard patten is to process the POST request then redirect (which will
    be a GET request). If the user hits back they go to the form page, not the
    form handler, so the data doesn't get reposted.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Aug 8, 2006
    #4
  5. On 2006-08-08 08:46:31 +0200, "ns21" <> said:

    > How can the browser back button be disabled If the form is submitting
    > information to other pages or submitting to itself or using
    > redirections.
    >
    > I tried the tweaks like history.forward(1) in each page to prevent user
    > to navigate back but its not very effective.
    >
    > The server side scripting is done using ASP.
    >
    > you may ask that why at first place I want to disable the browser back
    > button, this is due to the following issue
    > http://groups.google.co.in/group/aspnet/browse_thread/thread/77a38b4635b32b88
    >
    > In absence of response from responsible MVPs, I decided to provide a
    > back button in the application that use redirection mechanisms but
    > since user always has back button on browser, it makes the application
    > error-prone.
    >
    > Thanks,


    I doubt you can...
    History object should not be accessible (at least on W3C compliant
    browsers ...) .
    If you are using Firefox, have a look on PrivilegeManager, but I don't
    think you can change this behavior.

    --

    -- -- -- -- -- -- -- -- -- -- -- -- -- --
    http://schoenenberger.free.fr
    Fabien Schoenenberger, Aug 8, 2006
    #5
  6. ns21

    ns21 Guest

    David,

    This is a good option and it works for my small POC. but it cannot be
    applied to this application as there is lot of inline code and
    processing, its like performing the search and drill down pages, few
    drill down pages also perform search resulting in more pages.

    What is the main reason that the Page do not refresh automatically if
    submit was Hit and back is pressed?

    how do you handle this "submit hit + back enabled + NO page cannot be
    displayed error" in large applications that strictly dont allow any
    kind of cache?

    David Dorward wrote:

    > ns21 wrote:
    >
    > > How can the browser back button be disabled If the form is submitting
    > > information to other pages or submitting to itself or using
    > > redirections.

    >
    > The standard patten is to process the POST request then redirect (which will
    > be a GET request). If the user hits back they go to the form page, not the
    > form handler, so the data doesn't get reposted.
    >
    > --
    > David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    > Home is where the ~/.bashrc is
    ns21, Aug 8, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    7,149
  2. Steve C. Orr, MCSD

    Re: Browser-History-Back Button

    Steve C. Orr, MCSD, Aug 15, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    2,182
    mathieu cupryk
    Aug 16, 2003
  3. sylvia sil
    Replies:
    1
    Views:
    597
    Curt_C [MVP]
    Dec 29, 2004
  4. Author
    Replies:
    6
    Views:
    3,069
    George
    Jan 22, 2009
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    332
    Useful Info
    Jun 3, 2007
Loading...

Share This Page