Back Button

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

    #1

    Back Button

    I have written my first bit of php/sql code and set up a website with a
    small database.

    I use a html form and submit button to add/edit etc data.

    If you are editing data, after you have updated the database, if the user
    presses the back button repeatedly they scroll back through the previous
    screens which show the data BEFORE the update.

    I note on some site you get a "this page has expired" message if you try to
    scroll back.

    How can I do that? Or in some other way prevent outdated data from being
    displayed.

    Mike


  • Erwin Moller

    #2
    Re: Back Button

    Mike Scholl wrote:
    I have written my first bit of php/sql code and set up a website with a
    small database.
    >
    I use a html form and submit button to add/edit etc data.
    >
    If you are editing data, after you have updated the database, if the user
    presses the back button repeatedly they scroll back through the previous
    screens which show the data BEFORE the update.
    >
    I note on some site you get a "this page has expired" message if you try
    to scroll back.
    >
    How can I do that? Or in some other way prevent outdated data from being
    displayed.
    >
    Mike
    Hi Mike,

    That is a browserthing. Good browsers respect some headers that come with a
    document that say when a document expires. Caching influences this
    behaviour too.

    Here is a article:
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

    Read at least from point 14.9 (cache control) and 14.21 (expiration).

    And above all: TEST on a few browsers you want to support.
    If you stick to the RFC, you did what you could to get the desired
    behaviour, but be aware that the browser you use can be buggy (like some
    versions of IE) and you need to circumvent that by adding more headers.

    Regards,
    Erwin Moller

    Comment

    • Kimmo Laine

      #3
      Re: Back Button

      "Mike Scholl" <MikeScholl@bti nternet.comwrot e in message
      news:n6KdnSHR3v QX6cDYnZ2dnUVZ8 tSdnZ2d@bt.com. ..
      >I have written my first bit of php/sql code and set up a website with a
      >small database.
      >
      I use a html form and submit button to add/edit etc data.
      >
      If you are editing data, after you have updated the database, if the user
      presses the back button repeatedly they scroll back through the previous
      screens which show the data BEFORE the update.
      >
      I note on some site you get a "this page has expired" message if you try
      to scroll back.
      >
      How can I do that? Or in some other way prevent outdated data from being
      displayed.

      If you use FORMs, when the form method is POST, you'll get the
      expired-notification, but when the method is GET, it will not appear. This
      is logical, since get should be used when searching for data, the list needs
      to be generated just once, and you can go back to it again, but when
      updating or inserting something, POST should be used for posting the data
      just once, re-submitting should be rejected, or at least the browser should
      issue a warning. Well, most browsers work this way, the magic is the form
      method, weather it's POST or GET....

      --
      "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
      http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
      spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


      Comment

      • John Dunlop

        #4
        Re: Back Button

        Mike Scholl:
        I note on some site you get a "this page has expired" message if you try to
        scroll back.
        Well, you don't get the message from the server but from your
        browser. The reason for it is that some browsers try to re-request
        resources accessed through the history list, including POST requests;
        and since POST requests are, more often than not, uncacheable, the
        browser warns its user about a potentially unsafe interaction.

        However, history lists are 'meant to show exactly what the user saw
        at the time when the resource was retrieved' (RFC2616 : 13.13); in
        other words, going Back is not meant to result in a new request.


        How can I do that?
        Read up on what cache directives the browser du jour wants.
        Or in some other way prevent outdated data from being displayed.
        This is what the history list is _for_. Thankfully, you can't turn
        it off.

        --
        Jock

        Comment

        • Mike Scholl

          #5
          Re: Back Button

          Thanks for the suggestions. looks like I need to do a bit more studying but
          I think I can see more or less how to do it

          Mike


          Comment

          Working...