[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2850
  • Last Modified:

How can stop Safari caching pages regardless of metta tags or php headers that are meant to stop it from doing so.

I have a site written in PHP and call in swf file that loads lots of images from a XML file.
http://www.ftape.com/covers

I am trying to prevent safari from caching the images/xml as when I update images, the page still outputs the old imagery.
Note: the non-cache works fine with Internet Explorer, but I cannot get it to work with Safari.
Is there special coding that I am missing out?

I have the following in the coding of the page:


<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>

and

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
0
danieljaems
Asked:
danieljaems
1 Solution
 
JustWorkingCommented:
If you have pages you wish to prevent from being cached, including those that write out cookies, be sure to write the following headers when serving your pages:

      <? php
            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
            header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
            header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); // HTTP/1.1
            header("Cache-Control: post-check=0, pre-check=0", false);
            header("Pragma: no-cache"); // HTTP/1.0
      ?>

      // JSP example - call before writing page content
      response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
      response.setHeader("Pragma","no-cache"); //HTTP 1.0
      response.setDateHeader ("Expires", 0); //prevents caching on a proxy server as well

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now