SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Aug 2005
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I refresh a PHP page on browser back?

    Hi I wonder if anyone can help.

    I have a page with 2 dynamic headers. The first header shows a link to a sign-in page if the user isn't signed in. The second header shows the users name and a link to a sign out page if they are signed in.

    This all works well but I have spotted a usability problem. If the user clicks the link to the sign-in page then signs in and selects BACK the old sign-in header still shows. It looks as if they still need to sign-in, until they move off to another page then the correct header is shown.

    This is probably a problem with page caching. I have tried numerous things like "header (no-cache)" and unsetting the variable I test to see if the user is logged in all to no avail. I could test for a session variable but as with the header option - i am developing a template to be used on multiple websites and I don't want to require a session_start at the top of each page. I would prefer to keep my solution self-contained in the header.

    Has anyone had this problem before and is there an easy way to solve it?

    Thanks for your help
    Steven

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    There's no way.

    When a user hits the browser back button, it's not re-requesting the page from the server, it's cached on the browser. It's possible some browsers might re-request it depending on settings but not all do.

  3. #3
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,023
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wonshikee View Post
    There's no way.

    When a user hits the browser back button, it's not re-requesting the page from the server, it's cached on the browser. It's possible some browsers might re-request it depending on settings but not all do.
    In theory you send the cache headers to stop the browser from caching and requiring it to reload the page. In practice some browsers ignore these headers.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •