header functions doesn't work with Opera Why?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijcbe
    New Member
    • Sep 2007
    • 16

    header functions doesn't work with Opera Why?

    Hello friends!!
    I am having an issue.

    I tried to remove the data cached in a page using the below header() functions.

    Code:
    [code=php]header("Cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
    Header("Pragma" , "No-cache");

    if ($_SESSION["base"] != "1") /* where the value for base assigned in previous page.*/
    {
    // When user attempts to go back after the session was destroyed
    Header("Locatio n:error.html");
    }
    [/code]
    User who try to refresh or push back/forward button will transferred to a page which contains the error message, so that, the main page becomes unavailable to the user.

    This works perfectly in browsers like IE6+, Safari and Mozilla firefox. But, this doesn't work with Opera. I would be very happy, if some one resolves this issue for me.

    Thanks a million in advance.
    VJ.
    Last edited by ak1dnar; Oct 22 '07, 01:17 PM. Reason: Added [code=php]...[/code] tags
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi VJ.

    Cache control isn't really something you can depend on 100%. As you have encountered, some browsers will ignore them, while others will only acknowledge some unique headers or meta tags.
    You can't force browsers to do anything. You can ask them nicely, like your code does, but not all of them will listen to you.

    Opera seems to have some problems with cache control, although their website states that it supports it.

    Try writing your Pragma header like this, see if it helps, and add the Expires header:
    [code=php]
    header("Pragma: no-cache");
    header("Expires : -1");
    [/code]

    Comment

    • vijcbe
      New Member
      • Sep 2007
      • 16

      #3
      thanks a lot..
      I will try it..
      VJ

      Comment

      Working...