?
This document uses PHP Chinese website manual Release
HTTP Content-Security-Policy
(CSP)block-all-mixed-content
指令可防止在使用 HTTPS 加載頁面時使用 HTTP 加載任何資產(chǎn)。
所有混合內容資源請求都被阻止,包括主動和被動混合內容。這也適用于 <iframe>
文檔,確保整個頁面都是免費的混合內容。
upgrade-insecure-requests
指令在之前被評估block-all-mixed-content
,如果前者被設置,后者實際上是沒有操作的。建議設置一個指令或另一個 - 而不是兩個。
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">
要更精細地禁止http資產(chǎn),您還可以將單個指令設置為“https:”。例如,要禁止不安全的http映像:
Content-Security-Policy: img-src https:
規(guī)范 | 狀態(tà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) | ? | ? |