混合内容问题$http.得到AngularJS

Mixed Content Issue $http.get AngularJS

本文关键字:http 得到 AngularJS 问题 混合      更新时间:2023-09-26

我有一个在HTTPS协议上运行的应用程序。我写了一个Angular函数来使用$http service获取数据。

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://gainsight.0x10.info/api/image?page_no=0到https://gainsight.0x10.info/api/image?page_no=0在我的$http.get服务,不幸的是不可用。

任何帮助。感谢

删除协议!!

//...代替https://...

希望它能起作用:)

参考

即使您能够调用http端点,您也无法加载资源,因为它位于不同的域中,并且您有跨域问题(除非您使用json或cors修复该问题)

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