2016-08-12 5 views
0

Heute entdeckte den FehlerWarum Blocked Loading Mixed Active Content? Ich

Blocked loading mixed active content "http://ip-api.com/json/?callback=jQuery2240797948164524662_1471014635124&_=1471014635125"

in Firefox.

Hier ist mein Code

function getCurrentWeather(){ 
    $.getJSON("http://ip-api.com/json/?callback=?", function(data) { 
     var lat=data["lat"]; 
     var lon=data["lon"]; 
     updateWeatherDisplay(lat,lon);   
     updateAddress(data["city"],", "+data["region"]); 
    }); 
} 

Aber hier ist die andere Code, die eine gleichwertige Abfrage an den api macht - ohne Fehler !:

function getLocation() { 
    $.get('http://ip-api.com/json', function(loc) { 
     $('#location').text(loc.city + ', ' + loc.region + ', ' + loc.country); 
     getWeather(loc.lat, loc.lon, loc.countryCode); 
    }) 
    .fail(function(err) { 
     getWeather(); 
    }); 
} 

Beide Beispiele läuft auf https://codepen io.

Ich weiß bereits, dass ich https: // verwenden sollte, um zu api aufzurufen. Aber ich bin neugierig, warum keine Fehler im zweiten Beispiel?

+1

Mögliche Duplikat [Warum bin ich plötzlich ein verwenden kann immer "Blockiertes Laden gemischter aktiver Inhalte" Problem in Firefox?] (Http://stackoverflow.com/questions/18251128/why-am-i-suddenly-getting-a-blocked-loading-mixed-active-content-issue-in (fire) – Liam

+0

[Weil es eine Sicherheitslücke ist, Inhalte von einer nicht vertrauenswürdigen dritten Partei zu laden] (https://www.owasp.org/index.php/Cross- site_Scripting_ (XSS)) – Liam

+0

Ich stelle die Links hier nicht in die Frage. Mein Buggy-Beispiel - https://codepen.io/pbweb/pen/GqGYag?editors=1010. Und das funktioniert - http://codepen.io/l-emi/pen/OXBwxL – kurumkan

Antwort

1

Sein, weil https://codepen/sichere (https-Protokoll) und http://ip-api.comUnsichere (HTTP-Protokoll) verwendet wird verwenden.

ip-api.com derzeit nicht unterstützt https, wenn sie unterstützen https Sie sichere (https Protokoll) https://ip-api.com

function getCurrentWeather(){ 
    $.getJSON("https://ip-api.com/json/?callback=?", function(data) { 
    var lat=data["lat"]; 
    var lon=data["lon"]; 
    updateWeatherDisplay(lat,lon);   
    updateAddress(data["city"],", "+data["region"]); 
    }); 
} 
Verwandte Themen