第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在所有瀏覽器中控制網(wǎng)頁緩存?

如何在所有瀏覽器中控制網(wǎng)頁緩存?

慕容3067478 2019-05-22 13:10:24
我們的調(diào)查向我們表明,并非所有瀏覽器都以統(tǒng)一的方式尊重http緩存指令。出于安全原因,我們不希望在我們的應(yīng)用程序某些網(wǎng)頁緩存,有史以來,通過Web瀏覽器。這必須至少適用于以下瀏覽器:Internet Explorer 6+Firefox 1.5+Safari 3+Opera 9+鉻我們的要求來自安全測(cè)試。從我們的網(wǎng)站注銷后,您可以按后退按鈕查看緩存頁面。如何在所有瀏覽器中控制網(wǎng)頁緩存?
查看完整描述

4 回答

?
慕妹3242003

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超6個(gè)贊


首先,后退按鈕歷史記錄不是緩存

新鮮度模型(第4.2節(jié))不一定適用于歷史機(jī)制。也就是說,歷史機(jī)制即使已經(jīng)過期也可以顯示先前的表示。

在舊的HTTP規(guī)范中,措辭甚至更強(qiáng),明確告訴瀏覽器忽略后退按鈕歷史記錄的緩存指令。

回到應(yīng)該回到過去(到時(shí)候用戶登錄)。它不會(huì)向前導(dǎo)航到先前打開的URL。

但是,實(shí)際上,在非常特定的情況下,緩存可以影響后退按鈕:

  • 頁面必須通過HTTPS提供,否則此緩存破壞將不可靠。另外,如果您不使用HTTPS,那么您的頁面很容易受到許多其他方式的登錄竊取。

  • 你必須發(fā)送Cache-Control: no-store, must-revalidate(一些瀏覽器觀察no-store和一些觀察must-revalidate

永遠(yuǎn)不需要任何:

  • <meta>使用緩存標(biāo)頭 - 它根本不起作用。完全沒用。

  • post-checkpre-check- 它是僅適用于可緩存資源的IE-only指令。

  • 兩次或十幾個(gè)部分發(fā)送相同的標(biāo)題。一些PHP片段實(shí)際上取代了以前的標(biāo)題,導(dǎo)致只發(fā)送了最后一個(gè)。

如果需要,可以添加:

  • no-cache或者max-age=0,這將使資源(URL)“陳舊”,并要求瀏覽器檢查服務(wù)器是否有更新的版本(no-store已經(jīng)暗示這更強(qiáng))。

  • ExpiresHTTP / 1.0客戶端的過去日期(盡管這些天真正的 HTTP / 1.0僅客戶端完全不存在)。


查看完整回答
反對(duì) 回復(fù) 2019-05-22
?
桃花長相依

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超8個(gè)贊

正如porneL所述,您想要的不是停用緩存,而是停用歷史緩沖區(qū)。不同的瀏覽器有自己的微妙方法來禁用歷史緩沖區(qū)。

在Chrome(v28.0.1500.95 m)中,我們只能這樣做Cache-Control: no-store。

在FireFox(v23.0.1)中,其中任何一個(gè)都可以工作:

  1. Cache-Control: no-store

  2. Cache-Control: no-cache (僅限https)

  3. Pragma: no-cache (僅限https)

  4. Vary: * (僅限https)

在Opera(v12.15)中,我們只能通過Cache-Control: must-revalidate(僅限https)執(zhí)行此操作。

在Safari(v5.1.7,7534.57.2)中,任何一個(gè)都可以工作:

  1. Cache-Control: no-store 
    <body onunload=""> 在HTML中

  2. Cache-Control: no-store (僅限https)

在IE8(v8.0.6001.18702IC)中,任何一個(gè)都可以工作:

  1. Cache-Control: must-revalidate, max-age=0

  2. Cache-Control: no-cache

  3. Cache-Control: no-store

  4. Cache-Control: must-revalidate 
    Expires: 0

  5. Cache-Control: must-revalidate 
    Expires: Sat, 12 Oct 1991 05:00:00 GMT

  6. Pragma: no-cache (僅限https)

  7. Vary: * (僅限https)

結(jié)合上述內(nèi)容為我們提供了適用于Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7和Opera 12.15的解決方案:( Cache-Control: no-store, must-revalidate僅限https)

請(qǐng)注意,需要https,因?yàn)镺pera不會(huì)為普通的http頁面停用歷史記錄緩沖區(qū)。如果你真的無法獲得https并且你準(zhǔn)備忽略O(shè)pera,你可以做的最好的是:

Cache-Control: no-store<body onunload="">

下面顯示了我的測(cè)試的原始日志:

HTTP:

  1. 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,F(xiàn)ireFox 23,IE8,Safari 5.1.7

  2. Cache-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=""> 
    失?。篛pera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7

  3. Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    失?。篠afari 5.1.7,Opera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8

  4. Cache-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,F(xiàn)ireFox 23,IE8

  5. Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    <body onunload=""> 
    失敗:Chrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  6. 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=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  7. Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    <body onunload=""> 
    失敗:Chrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  8. 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=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  9. Cache-Control: no-store 
    失?。篠afari 5.1.7,Opera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8

  10. Cache-Control: no-store 
    <body onunload=""> 
    失?。篛pera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7

  11. Cache-Control: no-cache 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  12. Vary: * 
    失?。篊hrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7,Opera 12.15 
    成功:無

  13. Pragma: no-cache 
    失?。篊hrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7,Opera 12.15 
    成功:無

  14. 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=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  15. Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    <body onunload=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  16. Cache-Control: must-revalidate, max-age=0 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  17. Cache-Control: must-revalidate 
    Expires: 0 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  18. Cache-Control: must-revalidate 
    Expires: Sat, 12 Oct 1991 05:00:00 GMT 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7,Opera 12.15 
    成功:IE8

  19. Cache-Control: private, must-revalidate, proxy-revalidate, s-maxage=0 
    Pragma: no-cache 
    Vary: * 
    <body onunload=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7,Opera 12.15 
    成功:無

HTTPS:

  1. Cache-Control: private, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    <body onunload=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7,Opera 12.15 
    成功:無

  2. Cache-Control: private, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: Sat, 12 Oct 1991 05:00:00 GMT 
    <body onunload=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7,Opera 12.15 
    成功:無

  3. Vary: * 
    失敗:Chrome 28,Safari 5.1.7,Opera 12.15 
    成功:FireFox 23,IE8

  4. Pragma: no-cache 
    失?。篊hrome 28,Safari 5.1.7,Opera 12.15 
    成功:FireFox 23,IE8

  5. Cache-Control: no-cache 
    失敗:Chrome 28,Safari 5.1.7,Opera 12.15 
    成功:FireFox 23,IE8

  6. Cache-Control: private, no-cache, max-age=0, proxy-revalidate, s-maxage=0 
    失?。篊hrome 28,Safari 5.1.7,Opera 12.15 
    成功:FireFox 23,IE8

  7. Cache-Control: private, no-cache, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    失?。篊hrome 28,Safari 5.1.7,Opera 12.15 
    成功:FireFox 23,IE8

  8. Cache-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: * 
    失?。篊hrome 28,Safari 5.1.7,Opera 12.15 
    成功:FireFox 23,IE8

  9. Cache-Control: must-revalidate 
    失?。篊hrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7 
    成功:Opera 12.15

  10. Cache-Control: private, must-revalidate, proxy-revalidate, s-maxage=0 
    <body onunload=""> 
    失敗:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7 
    成功:Opera 12.15

  11. Cache-Control: must-revalidate, max-age=0 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7 
    成功:IE8,Opera 12.15

  12. 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=""> 
    失?。篊hrome 28,Safari 5.1.7 
    成功:FireFox 23,IE8,Opera 12.15

  13. Cache-Control: private, no-cache, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    <body onunload=""> 
    失?。篊hrome 28,Safari 5.1.7 
    成功:FireFox 23,IE8,Opera 12.15

  14. Cache-Control: no-store 
    失?。篛pera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7

  15. Cache-Control: private, no-cache, no-store, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    Pragma: no-cache 
    Vary: * 
    <body onunload=""> 
    失?。篛pera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7

  16. Cache-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=""> 
    失?。篛pera 12.15 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7

  17. Cache-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,IE8

  18. Cache-Control: must-revalidate 
    Expires: 0 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7, 
    成功:IE8,Opera 12.15

  19. Cache-Control: must-revalidate 
    Expires: Sat, 12 Oct 1991 05:00:00 GMT 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7, 
    成功:IE8,Opera 12.15

  20. Cache-Control: private, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: 0 
    <body onunload=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7, 
    成功:IE8,Opera 12.15

  21. Cache-Control: private, must-revalidate, max-age=0, proxy-revalidate, s-maxage=0 
    Expires: Sat, 12 Oct 1991 05:00:00 GMT 
    <body onunload=""> 
    失?。篊hrome 28,F(xiàn)ireFox 23,Safari 5.1.7, 
    成功:IE8,Opera 12.15

  22. Cache-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.15

  23. Cache-Control: no-store, must-revalidate 
    失?。簾o 
    成功:Chrome 28,F(xiàn)ireFox 23,IE8,Safari 5.1.7,Opera 12.15


查看完整回答
反對(duì) 回復(fù) 2019-05-22
?
波斯汪

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超4個(gè)贊

我發(fā)現(xiàn)web.config路由很有用(嘗試將其添加到答案中但似乎沒有被接受,因此在此處發(fā)布)

<configuration><system.webServer>
    <httpProtocol>
        <customHeaders>
            <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
            <!-- HTTP 1.1. -->
            <add name="Pragma" value="no-cache" />
            <!-- HTTP 1.0. -->
            <add name="Expires" value="0" />
            <!-- Proxies. -->
        </customHeaders>
    </httpProtocol></system.webServer>


這是express / node.js做同樣的方式:

app.use(function(req, res, next) {
    res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
    res.setHeader('Pragma', 'no-cache');
    res.setHeader('Expires', '0');
    next();});


查看完整回答
反對(duì) 回復(fù) 2019-05-22
  • 4 回答
  • 0 關(guān)注
  • 992 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)