各位我想知道你是否在这段代码上看到任何会导致无限重定向的内容。我只是想不出来。这是使用正确加载的GeoIP2 API。
var redirect = (function () {
var onSuccess = function (geoipResponse) {
var sites = {
"cn": true
};
if (!geoipResponse.country.iso_code) {
window.location.replace("http://gotriplec.com/");
}
var code = geoipResponse.country.iso_code.toLowerCase();
if (sites[code]) {
alert("Your IP cannot access this website... We apologize for any inconvenience caused.");
window.location.replace("http://www.google.com");
}
else {
window.location.replace("http://gotriplec.com/");
}
};
var onError = function (error) {
window.location.replace("http://gotriplec.com/");
};
return function () {
geoip2.country( onSuccess, onError );
};
}());
答案 0 :(得分:0)
没有查看代码的其他部分,不能说太多,但如果您的网站是" http://gotriplec.com/"并且您在此页面上的页面加载/就绪时调用redirect()
,该场景将导致无限重定向。