Mixed Content: xxx This request has been blocked; the content must be served over HTTPS.

在升級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

 

發佈了61 篇原創文章 · 獲贊 4 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章