防止HTML页面的缓存

编程入门 行业动态 更新时间:2024-10-21 15:52:13
本文介绍了防止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-10-08 01:38:24,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   页面   HTML

发布评论

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

>www.elefans.com

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