JavaScript scripting methods for judging spider origins _javascript Tips

Source: Internet
Author: User

Today's introduction of this JS to determine the source of the spider's method script is written in the body of the onload. That is, the page is loaded to judge. The code is as follows:

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";
}

This JS to judge the source method of spiders is not very useful. Especially when you need to judge more spider sources, the code is more cumbersome to write.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.