此請求已被阻止;內容必須通過HTTPS提供 [英] This request has been blocked; the content must be served over HTTPS

查看:25845
本文介紹了此請求已被阻止;內容必須通過HTTPS提供的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我嘗試執行ajax,我的代碼寫在https網站上請求非https,但資源被Chrome阻止。

I try to do ajax, my code written on a https site it request to non https, but the resources were blocked by Chrome.

            $.ajax({
                url : "http://example.com/non-https",
..
..

以前在早期版本中我沒有這個問題。我的ajax請求也必須以https為目標嗎?或者有更好的方法來保存這個問題?

Previously in earlier version I don't have this issue. Must my ajax request target a https too? Or there is a better way to save that problem?

推薦答案

只需更改你的url變量中 http:// // ,所以當頁面加載http時,ajax請求將使用http協議,如果加載https,瀏覽器將ajax請求協議設置為https。即,您的代碼應如下所示:

Just change the http:// in your url variable to //, so when the page is loaded with http, the ajax request would use the http protocol, if loaded with https, the ajax request protocol would be set by the browser to https. i.e, your code should look like:

           $.ajax({
                url : "http://example.com/non-https",
..
..

這篇關于此請求已被阻止;內容必須通過HTTPS提供的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持IT屋!

查看全文
相關文章
登錄 關閉
掃碼關注1秒登錄
發送“驗證碼”獲取 | 15天全站免登陸
全免费A级毛片免费看无码播放