簡體   English   中英

混合內容發行$ http.get AngularJS

[英]Mixed Content Issue $http.get AngularJS

我有一個運行在HTTPS協議上的應用程序。 我編寫了一個Angular函數,以使用$ http服務獲取數據。

factory.loadImages = function(callback){

        $http.get("http://gainsight.0x10.info/api/image?page_no=0")
             .success(function(data){

                callback(data);

            }).error(function(status,error){

                console.log(status);

            });
    };

我收到以下混合內容錯誤:

Mixed Content: The page at 'https://www.hackerearth.com/gainsight-ui-development-hiring-challenge-1/problems/30146b3bf6954bba9752bd5599b3c8aa/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://gainsight.0x10.info/api/image?page_no=0'. This content should also be served over HTTPS.

現在我嘗試將$http.get服務中的http://gainsight.0x10.info/api/image?page_no=0更改為https://gainsight.0x10.info/api/image?page_no=0不幸的是不可用。

任何幫助..萬分感謝

刪除協議!

而不是使用https://...而是使用//...

希望它能工作:)

參考

即使您能夠調用http終結點,您也將無法加載資源,因為它位於其他域上並且存在跨域問題(除非您使用jsonp或cors進行了修復)

http://www.d-mueller.de/blog/cross-domain-ajax-guide/

暫無
暫無

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

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