防止HTML页面的缓存 [英] Prevent caching of HTML page

查看:136
本文介绍了防止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页面的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆