Home > Web Front-end > JS Tutorial > body text

How to determine the source of spiders using JavaScript script_javascript skills

WBOY
Release: 2016-05-16 15:38:16
Original
1586 people have browsed it

The JS script introduced today is written in the onload of the body. That is, the judgment is made when the page is loaded. 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";
}
 
}
);}
Copy after login

This JS method of determining the source of spiders is not easy to use. Especially when more spider sources need to be determined, it is more troublesome to write code.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!