防止缓存 HTML 页面

编程入门 行业动态 更新时间:2024-10-10 00:26:02
本文介绍了防止缓存 HTML 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个 HTML 页面.问题是我不想让用户每次添加新内容时都刷新页面.

I have a HTML page. The problem is that I do not want to have the users to refresh the page each time I put on new content.

为了确保页面不被缓存,我有以下代码:

I have the following code in order to make sure that the page is not cached:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Expires" content="0"/>

问题是,我仍然需要刷新页面才能显示最新的内容.难道我做错了什么?我应该使用其他标签吗?

The problem is, I still need to do a refresh on the page in order to get the most current content to show up. Am I doing something wrong? Should I be using some other tags?

推荐答案

你的值没问题,但是 meta http-equiv 非常不可靠.您应该使用真正的 HTTP 标头(具体如何操作取决于您的服务器,例如 对于 Apache).

The values you have there are OK, but meta http-equiv is highly unreliable. You should be using real HTTP headers (the specifics of how you do this will depend on your server, e.g. for Apache).

更多推荐

防止缓存 HTML 页面

本文发布于:2023-11-01 11:01:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549158.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   页面   HTML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!