如何让 Firefox 不缓存我的网页

发布于 2024-10-07 02:59:22 字数 1519 浏览 7 评论 0原文

我有这个页面,我们称之为 index.php

index.php 有一个用户列表和一个删除用户按钮。这会将他们带到 removeUser.php

removeUser.php 的最后一行是返回到 index.php

但在 Firefox 中,它看起来仍然一样,普通用户不知道如何在每次手动加载页面时进行硬刷新或清除缓存。

我已经尝试过

CACHE-CONTROL NO-CACHE,NO-STORE

PRAGMA NO-CACHE,NO-STORE

甚至尝试在 META 标记中设置 EXPIRY 0 ,但这些都没有帮助。虽然这一切在 Chrome 和其他浏览器中都能完美运行,但只有 Firefox 存在这个问题。

这些是我的标题,应 @alex 的要求

http://localhost/xChange/home.php

GET /xChange/home.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost/xChange/home.php
Cookie: laobgcidne=yes; [email protected]
Cache-Control: max-age=0

HTTP/1.1 200 OK
Date: Fri, 10 Dec 2010 08:28:25 GMT
Server: Apache/2.2.11 (Win32) PHP/5.3.0
X-Powered-By: PHP/5.3.0
Cache-Control: no-cache, must-revalidate
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Content-Length: 6130
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

I have this page, let's call it index.php

index.php has a list of users and a remove user button. That will take them to removeUser.php

And the last line of removeUser.php is to go back to index.php

But in Firefox, it still looks the same, a normal user won't know how to do a hard-refresh or clear the cache every time the page loads manually.

I have tried

CACHE-CONTROL NO-CACHE,NO-STORE

and also

PRAGMA NO-CACHE,NO-STORE

I even tried setting EXPIRY 0 in the META tags, none of these help. Although it all works perfectly in Chrome and other browsers, it's just Firefox that has this problem.

These are my headers, requested by @alex

http://localhost/xChange/home.php

GET /xChange/home.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost/xChange/home.php
Cookie: laobgcidne=yes; [email protected]
Cache-Control: max-age=0

HTTP/1.1 200 OK
Date: Fri, 10 Dec 2010 08:28:25 GMT
Server: Apache/2.2.11 (Win32) PHP/5.3.0
X-Powered-By: PHP/5.3.0
Cache-Control: no-cache, must-revalidate
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Content-Length: 6130
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

忆伤 2024-10-14 02:59:22

发送过去日期的过期标头。

示例

header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

来源

更新

你的标题看起来不错。我不知道火狐在做什么。

您可以在链接上执行此操作,以确保它始终下载新的副本。

<?php $link = 'home.php'; ?>
<a href="<?php echo $link . '?m=' . filemtime($link); ?>">Home</a>

Send a expires header for a date in the past.

Example

header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

Source.

Update

Your headers look pretty good. I don't know what Firefox is doing.

You could do this on the link, to make sure it always downloads a fresh copy.

<?php $link = 'home.php'; ?>
<a href="<?php echo $link . '?m=' . filemtime($link); ?>">Home</a>
﹉夏雨初晴づ 2024-10-14 02:59:22
深居我梦 2024-10-14 02:59:22

只需按 Ctrl+F5 即可在浏览器页面上进行硬刷新,它会删除当前页面的缓存并加载新编辑的页面

Simply Press Ctrl+F5 for hard refresh on your browser page it removes Cache of current page and load the newly Edited Page

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文