开发者

Why doesn't Safari honor my cache-control directive?

There is a particular page that I would like the browser to always load, particularly when the user presses the browser back button to get to it.

So I use the following 'Cache-Control' d开发者_Go百科irective in the header for this page (taking the PHP directly from my code).

$headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';

This works for FF, IE and Chrome, but Safari (5.0.1) seems to ignore the directive and fails to reload the page (across multiple users, so it doesn't seem to be a setup specific problem). Searching hasn't revealed any known bugs, so I'm assuming there is something amiss on my end.

Any pointers would be much appreciated.

Update: just found this answer on SO.

Safari browser ignoring my no-cache

Haven't tried it yet, but looks promising. Very strange that it is an addition to the body tag, so Im skeptical.


The answer is to include the following attribute in the body tag to force Safari to reload the page:

onunload=""

As in:

<body onunload="">

I found this here: Safari browser ignoring my no-cache

Which in turn got it from this thread: Is there a cross-browser onload event when clicking the back button?


Also see this Webkit bug report: https://bugs.webkit.org/show_bug.cgi?id=71509

I am experiencing the same issue, and it appears to be to be a bug in Safari.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜