在升級https的過程中,出現如下問題:
Mixed Content: The page at 'https://www.xxx.com/denglu.html' was loaded over HTTPS, but requested an insecure script 'http://qzonestyle.gtimg.cn/qzone/openapi/qc-1.0.1.js'. This request has been blocked; the content must be served over HTTPS.
問題拋出:如何在HTTPS 網頁中引入HTTP資源: Mixed Content?
問題原因:HTTPS頁面裏動態的引入HTTP資源,比如引入一個js文件,會被直接block掉的.在HTTPS頁面裏通過AJAX的方式請求HTTP資源,也會被直接block掉的。
解決方案:
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
可以在相應的頁面的<head>里加上這句代碼,意思是自動將http的不安全請求升級爲https
參考:https://thehackernews.com/2015/04/disable-mixed-content-warning.html