You are here

某个网站的屏蔽中国访客措施的javascript代码

1,时区是东八区的转到Google
2,浏览器是中文的 也转到Google

代码如下:

var dt=new Date();
if(dt.getTimezoneOffset()==-480)
{
document.write(top.window.location.href="http://www.google.com");
}
if (navigator.appName == 'Netscape')
{
var nl= navigator.language;
}
else
{
var nl= navigator.browserLanguage;
var sysnl= navigator.systemLanguage;
var usernl= navigator.userLanguage;
}
if(sysnl.indexOf('zh')>=0)
{
document.write(top.window.location.href="http://www.google.com");
}
if(usernl.indexOf('zh')>=0)
{
document.write(top.window.location.href="http://www.google.com");
}
if(nl.indexOf('zh')>=0)
{
document.write(top.window.location.href="http://www.google.com");
}
document.write(top.window.location.href="http://www.google.com");

文章类型: