为什么我的页面不会停止缓存?

jon*_*ony 5 html caching metadata header meta-tags

我正在使用这个标题(见下文).那么为什么我的页面会继续在IE上缓存???

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <META NAME="MSSmartTagsPreventParsing" CONTENT="True">
 <META HTTP-EQUIV="Expires" CONTENT="0">
 <META HTTP-EQUIV="Pragma" CONTENT="No-Cache">
 <META HTTP-EQUIV="Cache-Control" CONTENT="No-Cache,Must-Revalidate,No-Store">
 <META NAME="Robots" CONTENT="NoIndex,NoFollow">
 <META ondragstart="return false" onselectstart="return false" http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
Run Code Online (Sandbox Code Playgroud)

问题解决了!!!而不是.html或.htm使用.php并使用像这样的php标头:

<?php
 header("Cache-Control: no-cache, must-revalidate");
 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
 header("Cache-Control: no-cache, no-store, must-revalidate");
 header("Pragma: no-cache");
?>
Run Code Online (Sandbox Code Playgroud)

awm*_*awm 0

除了其他建议之外,尝试向页面请求添加动态值,这将有更好的机会不缓存。

(即 /foo.html?a=9585874034854 (或纪元或其他同样动态的东西)。

另外,您的标头需要: Cache-Control: no-cache, no-store

这告诉系统不要缓存它,甚至不将其存储在缓存中。