簡體   English   中英

不允許 Firefox 中的混合內容

[英]Cannot allow mixed content in Firefox

我在控制台中粘貼了以下代碼以嘗試導入 jQuery:

var jq = document.createElement("script");
jq.src = "http://code.jquery.com/jquery-3.6.0.min.js";
document.getElementsByTagName("head")[0].appendChild(jq);

然而這個 output 顯示:

Loading failed for the <script> with source "http://code.jquery.com/jquery-3.6.0.min.js".
Content Security Policy: The page's settings blocked the loading of a resource at http://code.jquery.com/jquery-3.6.0.min.js ("script-src").

正如MDN 文章所說,我似乎需要啟用混合內容:

  1. 單擊地址欄中的掛鎖圖標。
  2. 單擊站點信息面板中的箭頭。
  3. 單擊“暫時禁用保護”

但是,現在按鈕沒有禁用保護,就好像它從未嘗試加載混合內容一樣。

這是一個錯誤嗎? 為什么我不能在控制台中啟用混合內容?

出於安全原因,瀏覽器停止允許通過https提供的內容來自通過http提供的網站。

So you can simply solve your issue by replacing " http ://code.jquery.com/jquery-3.6.0.min.js" with " https ://code.jquery.com/jquery-3.6.0.min. js”。

文檔中的更多詳細信息: https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM