?
Ce document utilise Manuel du site Web PHP chinois Libérer
HTTP Content-Security-Policy
(CSP)block-all-mixed-content
指令可防止在使用 HTTPS 加載頁(yè)面時(shí)使用 HTTP 加載任何資產(chǎn)。
所有混合內(nèi)容資源請(qǐng)求都被阻止,包括主動(dòng)和被動(dòng)混合內(nèi)容。這也適用于 <iframe>
文檔,確保整個(gè)頁(yè)面都是免費(fèi)的混合內(nèi)容。
upgrade-insecure-requests
指令在之前被評(píng)估block-all-mixed-content
,如果前者被設(shè)置,后者實(shí)際上是沒有操作的。建議設(shè)置一個(gè)指令或另一個(gè) - 而不是兩個(gè)。
Content-Security-Policy: block-all-mixed-content;
Content-Security-Policy: block-all-mixed-content;<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
要更精細(xì)地禁止http資產(chǎn),您還可以將單個(gè)指令設(shè)置為“https:”。例如,要禁止不安全的http映像:
Content-Security-Policy: img-src https:
規(guī)范 | 狀態(tài) | 評(píng)論 |
---|---|---|
混合內(nèi)容該規(guī)范中的“block-all-mixed-content”的定義。 | 候選推薦 | 初始定義。 |
特征 | Chrome | Firefox | Edge | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
基本支持 | (Yes) | 48.0 | ? | (No) | (Yes) | ? |
特征 | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
基本支持 | ? | (Yes) | ? | 48.0 | (No) | ? | ? |