桃花长相依
正如porneL所述,您想要的不是停用缓存,而是停用历史缓冲区。不同的浏览器有自己的微妙方法来禁用历史缓冲区。在Chrome(v28.0.1500.95 m)中,我们只能这样做Cache-Control: no-store。在FireFox(v23.0.1)中,其中任何一个都可以工作:Cache-Control: no-storeCache-Control: no-cache (仅限https)Pragma: no-cache (仅限https)Vary: * (仅限https)在Opera(v12.15)中,我们只能通过Cache-Control: must-revalidate(仅限https)执行此操作。在Safari(v5.1.7,7534.57.2)中,任何一个都可以工作:Cache-Control: no-store <body onunload=""> 在HTML中Cache-Control: no-store (仅限https)在IE8(v8.0.6001.18702IC)中,任何一个都可以工作:Cache-Control: must-revalidate, max-age=0Cache-Control: no-cacheCache-Control: no-storeCache-Control: must-revalidate Expires: 0Cache-Control: must-revalidate Expires: Sat, 12 Oct 1991 05:00:00 GMTPragma: no-cache (仅限https)Vary: * (仅限https)结合上述内容为我们提供了适用于Chrome 28,FireFox 23,IE8,Safari 5.1.7和Opera 12.15的解决方案:( Cache-Control: no-store, must-revalidate仅限https)请注意,需要https,因为Opera不会为普通的http页面停用历史记录缓冲区。如果你真的无法获得https并且你准备忽略Opera,你可以做的最好的是:Cache-Control: no-store<body onunload="">下面显示了我的测试的原始日志:HTTP:Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * <body onunload=""> 失败:Opera 12.15 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * <body onunload=""> 失败:Opera 12.15 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * 失败:Safari 5.1.7,Opera 12.15 成功:Chrome 28,FireFox 23,IE8Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * 失败:Safari 5.1.7,Opera 12.15 成功:Chrome 28,FireFox 23,IE8Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: no-store 失败:Safari 5.1.7,Opera 12.15 成功:Chrome 28,FireFox 23,IE8Cache-Control: no-store <body onunload=""> 失败:Opera 12.15 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7Cache-Control: no-cache 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Vary: * 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7,Opera 12.15 成功:无Pragma: no-cache 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7,Opera 12.15 成功:无Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: must-revalidate, max-age=0 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: must-revalidate Expires: 0 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: must-revalidate Expires: Sat, 12 Oct 1991 05:00:00 GMT 失败:Chrome 28,FireFox 23,Safari 5.1.7,Opera 12.15 成功:IE8Cache-Control: private, must-revalidate, proxy-revalidate, s-maxage=0 Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7,Opera 12.15 成功:无HTTPS:Cache-Control: private, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 <body onunload=""> 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7,Opera 12.15 成功:无Cache-Control: private, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT <body onunload=""> 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7,Opera 12.15 成功:无Vary: * 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Pragma: no-cache 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Cache-Control: no-cache 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Cache-Control: private, no-cache, max-age=0, proxy-revalidate, s-maxage=0 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Cache-Control: private, no-cache, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Cache-Control: private, no-cache, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Cache-Control: must-revalidate 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7 成功:Opera 12.15Cache-Control: private, must-revalidate, proxy-revalidate, s-maxage=0 <body onunload=""> 失败:Chrome 28,FireFox 23,IE8,Safari 5.1.7 成功:Opera 12.15Cache-Control: must-revalidate, max-age=0 失败:Chrome 28,FireFox 23,Safari 5.1.7 成功:IE8,Opera 12.15Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,Safari 5.1.7 成功:FireFox 23,IE8,Opera 12.15Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * <body onunload=""> 失败:Chrome 28,Safari 5.1.7 成功:FireFox 23,IE8,Opera 12.15Cache-Control: no-store 失败:Opera 12.15 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7Cache-Control: private, no-cache, no-store, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 Pragma: no-cache Vary: * <body onunload=""> 失败:Opera 12.15 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7Cache-Control: private, no-cache, no-store, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * <body onunload=""> 失败:Opera 12.15 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7Cache-Control: private, no-cache Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * 失败:Chrome 28,Safari 5.1.7,Opera 12.15 成功:FireFox 23,IE8Cache-Control: must-revalidate Expires: 0 失败:Chrome 28,FireFox 23,Safari 5.1.7, 成功:IE8,Opera 12.15Cache-Control: must-revalidate Expires: Sat, 12 Oct 1991 05:00:00 GMT 失败:Chrome 28,FireFox 23,Safari 5.1.7, 成功:IE8,Opera 12.15Cache-Control: private, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: 0 <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7, 成功:IE8,Opera 12.15Cache-Control: private, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 Expires: Sat, 12 Oct 1991 05:00:00 GMT <body onunload=""> 失败:Chrome 28,FireFox 23,Safari 5.1.7, 成功:IE8,Opera 12.15Cache-Control: private, must-revalidate Expires: Sat, 12 Oct 1991 05:00:00 GMT Pragma: no-cache Vary: * 失败:Chrome 28,Safari 5.1.7 成功:FireFox 23,IE8,Opera 12.15Cache-Control: no-store, must-revalidate 失败:无 成功:Chrome 28,FireFox 23,IE8,Safari 5.1.7,Opera 12.15