我有一个 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 页面
发布评论