2

I have an application running on HTTPS protocol. I wrote an Angular function to get the data using $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);

            });
    };

I am getting the below Mixed Content errors:

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.

Now i tried to change the http://gainsight.0x10.info/api/image?page_no=0 to https://gainsight.0x10.info/api/image?page_no=0 in my $http.get service which is unfortunately not available.

Any Help.. Much appreciated

Yameen
  • 585
  • 1
  • 6
  • 17

2 Answers2

0

Remove the protocol!!

Instead of using https://... just use //....

Hope it works :)

Reference

Community
  • 1
  • 1
Defesa Esquerdo
  • 290
  • 2
  • 3
  • 10
-1

Even if you are able to call an http endpoint you will not be able to load the ressource because it is on a different domain and you have a cross domain issue (unless you fix that with jsonp or cors )

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

Mathias F
  • 15,906
  • 22
  • 89
  • 159