Disabling the browser's 'Back' button

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jcnews

    #1

    Disabling the browser's 'Back' button

    When designing a webpage, is there a way to disable the back button? It
    must be possible.



    I am asking because there are certain web applications that I have used that
    require the user to never press the back button from certain screens. If
    the back button is pressed, it will bill for charges, even if the user is
    pressing the back button as a way of canceling. Another example would be
    Mambo CMS -- if you click the back button on certain screens it checks out
    the content and you have to do a 'global checking' to unlock it which can
    cause other problems if not done right.



    I'm hoping there is a way to fix this. Otherwise, maybe there is a way to
    get rid of the back button with javascript without opening a new window? I
    don't want to get rid of the toolbar, but just to disable that feature.



    Any tips would be appreciated.






  • Andrew Thompson

    #2
    Re: Disabling the browser's 'Back' button

    On Sun, 26 Sep 2004 20:32:40 GMT, jcnews wrote:
    [color=blue]
    > ..is there a way to disable the back button?[/color]

    <http://www.jibbering.c om/faq/#FAQ4_2>

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.lensescapes.com/ Images that escape the mundane

    Comment

    • Jim Ley

      #3
      Re: Disabling the browser's 'Back' button

      On Sun, 26 Sep 2004 20:32:40 GMT, "jcnews" <jcnews@earthli nk.net>
      wrote:
      [color=blue]
      >When designing a webpage, is there a way to disable the back button? It
      >must be possible.[/color]

      No, and it's a FAQ, so please see the FAQ at http://jibbering.com/faq/

      Jim.
      [color=blue]
      >I am asking because there are certain web applications that I have used that
      >require the user to never press the back button from certain screens. If
      >the back button is pressed, it will bill for charges, even if the user is
      >pressing the back button as a way of canceling.[/color]

      That's a bad e-commerce site, and with an organisation so negligent, I
      wouldn't trust them with my credit card details - keep away!

      Jim.

      Comment

      • Richard Cornford

        #4
        Re: Disabling the browser's 'Back' button

        jcnews wrote:[color=blue]
        > When designing a webpage, is there a way to disable
        > the back button? It must be possible.[/color]

        You can't so much disable the back button but you can take action that
        will break it for some users. Though the fact that you cannot break it
        for all users renders the attempt futile.
        [color=blue]
        > I am asking because there are certain web applications
        > that I have used that require the user to never press
        > the back button from certain screens. ...[/color]

        There are a surprising number of web application authors who operate
        with a disregard for (or ignorance of) the nature of both HTTP and their
        web browser clients.

        <snip>[color=blue]
        > I'm hoping there is a way to fix this.[/color]

        It is a matter of designing server-side code that is suited to being
        operated over a stateless protocol form a web browser client. Where the
        use of a 'back' facility and the re-submission of a form for an action
        that has already happened, does not result in the server-side code
        attempting something stupid. (it is also off topic for this group)
        [color=blue]
        > Otherwise, maybe there is a way to get rid of the back
        > button with javascript without opening a new window?[/color]

        You cannot even get rid of the 'back' facility by opening a new window.
        [color=blue]
        > I don't want to get rid of the toolbar, but just to
        > disable that feature.[/color]

        The tool bar is not the only way of activating the 'back' facility
        anyway.
        [color=blue]
        > Any tips would be appreciated.[/color]

        Look into server-side sessions and think about how they can be used to
        keep track of the state of the user's interaction with the server.

        Client side scripting can contribute nothing to the solution of this
        problem.

        Richard.


        Comment

        • Frances Del Rio

          #5
          Re: Disabling the browser's 'Back' button



          Jim Ley wrote:[color=blue]
          > On Sun, 26 Sep 2004 20:32:40 GMT, "jcnews" <jcnews@earthli nk.net>
          > wrote:
          >
          >[color=green]
          >>When designing a webpage, is there a way to disable the back button? It
          >>must be possible.[/color]
          >
          >
          > No, and it's a FAQ, so please see the FAQ at http://jibbering.com/faq/[/color]

          No? I have visited a number of pages where the back button doesn't
          work, how do they do it??

          Frances

          Comment

          • Andrew Thompson

            #6
            Re: Disabling the browser's 'Back' button

            On Sun, 26 Sep 2004 20:38:59 -0400, Frances Del Rio wrote:
            [color=blue][color=green]
            >> No, and it's a FAQ, so please see the FAQ at http://jibbering.com/faq/[/color]
            >
            > No? I have visited a number of pages[/color]

            a) UA?
            [color=blue]
            >..where the back button doesn't work, ..[/color]

            Probably a)

            --
            Andrew Thompson
            http://www.PhySci.org/codes/ Web & IT Help
            http://www.PhySci.org/ Open-source software suite
            http://www.1point1C.org/ Science & Technology
            http://www.lensescapes.com/ Images that escape the mundane

            Comment

            • Jim Ley

              #7
              Re: Disabling the browser's 'Back' button

              On Sun, 26 Sep 2004 20:38:59 -0400, Frances Del Rio <fdr58@yahoo.co m>
              wrote:
              [color=blue]
              >Jim Ley wrote:[color=green]
              >> On Sun, 26 Sep 2004 20:32:40 GMT, "jcnews" <jcnews@earthli nk.net>
              >> wrote:
              >>
              >>[color=darkred]
              >>>When designing a webpage, is there a way to disable the back button? It
              >>>must be possible.[/color]
              >>
              >>
              >> No, and it's a FAQ, so please see the FAQ at http://jibbering.com/faq/[/color]
              >
              >No? I have visited a number of pages where the back button doesn't
              >work, how do they do it??[/color]

              Define doesn't work - maybe it was the suggestion in the FAQ to use
              replace on every link, maybe it wasn't that it didn't work, but it
              didn't go where you expected - IE has some wrong behaviour (in HTTP
              terms) whereby it makes new requests when revisiting pages - it
              doesn't really disable the back-button.

              Jim.

              Comment

              • Frances Del Rio

                #8
                Re: Disabling the browser's 'Back' button



                Jim Ley wrote:[color=blue]
                > On Sun, 26 Sep 2004 20:38:59 -0400, Frances Del Rio <fdr58@yahoo.co m>
                > wrote:
                >
                >[color=green]
                >>Jim Ley wrote:
                >>[color=darkred]
                >>>On Sun, 26 Sep 2004 20:32:40 GMT, "jcnews" <jcnews@earthli nk.net>
                >>>wrote:
                >>>
                >>>
                >>>
                >>>>When designing a webpage, is there a way to disable the back button? It
                >>>>must be possible.
                >>>
                >>>
                >>>No, and it's a FAQ, so please see the FAQ at http://jibbering.com/faq/[/color]
                >>
                >>No? I have visited a number of pages where the back button doesn't
                >>work, how do they do it??[/color]
                >
                >
                > Define doesn't work - maybe it was the suggestion in the FAQ to use
                > replace on every link, maybe it wasn't that it didn't work, but it
                > didn't go where you expected - IE has some wrong behaviour (in HTTP
                > terms) whereby it makes new requests when revisiting pages - it
                > doesn't really disable the back-button.[/color]

                ok, next time I see one I will post.. u click on 'back' button and
                either it's ignored or simply refreshes current page... I always
                assumed this was done w/JavaScript, that it had to do w/history object..



                Comment

                • kaeli

                  #9
                  Re: Disabling the browser's 'Back' button

                  In article <2rr46uF1e73ibU 1@uni-berlin.de>, fdr58@yahoo.com enlightened us
                  with...[color=blue]
                  >
                  >
                  > ok, next time I see one I will post.. u click on 'back' button and
                  > either it's ignored or simply refreshes current page... I always
                  > assumed this was done w/JavaScript, that it had to do w/history object..
                  >[/color]

                  My guess is that if you pulled down the arrow next to the back button and
                  went back *two* pages, you'd get the content back. ;)

                  This is easily done with a simple redirect (server-side) or a replace
                  (client-side), but it doesn't "break" the back button. The button still
                  functions and the history is not lost.

                  The history object is not readable or writable by normal client-side JS. The
                  only thing you can do is use forward and back with scripting.

                  Server-side code should always allow for refreshing the page (there are
                  various ways to do that). That said, sometimes people inherit bad code and
                  need an interim hack. If that is the case, and javascript is guaranteed
                  (intranet) you can simply replace the contents of the current window,
                  overwriting history (location.repla ce). Back will still function, but it will
                  take it to the previous page. You may be seeing sites doing that, too.
                  This should by no means be considered a permanent fix, IMO. Solid server-side
                  code negates the need for any of these types of hacks.

                  --
                  --
                  ~kaeli~
                  Acupuncture is a jab well done.



                  Comment

                  • B Wisentaner

                    #10
                    Re: Disabling the browser's 'Back' button

                    On Sun, 26 Sep 2004 20:32:40 GMT, "jcnews" <jcnews@earthli nk.net>
                    wrote:
                    [color=blue]
                    >When designing a webpage, is there a way to disable the back button? It
                    >must be possible.[/color]

                    See RFC 2616 paragraph 13.13 for what the standard requires.


                    It's a bad idea to attempt to block browser Back button (which won't
                    stop management or customers from asking for it, I learned the hard
                    way.) I make my form processing resilient to this, treating it as a
                    race conditon. In past, I have put in a hidden input that was set to
                    Date/getTime(). Server side could determine if it was a repost by
                    seeing if it already got that timestamp from that client (KLUGE, I
                    know.)

                    ---Bruce Wisentaner
                    ---No spam accepted

                    Comment

                    Working...