复制代码 代码如下:
<script type="text/javascript">
if(self!=top){top.location=self.location;}
var ref=document.referrer;
var domains=new Array("jb51.net/","jb51.cn/","jb51.com.cn/");
var refpass=false;
for(i=0;i<=domains.length;i++){if(ref.indexOf(domains[i])>0){refpass=true;break;}}
if(ref==""){refpass=true}
if(!refpass){window.location.href='https://www.jb51.net';}
</script>


推荐

复制代码 代码如下:
<script>
function isMatch(str1,str2)

var index = str1.indexOf(str2);
if(index==-1) return false;
return true;
}
alert(window.location.hostname);
if (isMatch(window.location.hostname,'www.jb51.net') == false){window.location.href="https://www.jb51.net";}
</script>

下面我们一个网站开发中用到的

复制代码 代码如下:
function gotourl()
{
 var url = "https://www.jb51.net";
 var localurl = document.url;
 if( localurl.substring(0,url.length) != url )
 {
  location.href=url;
 }
}
gotourl();

标签:
来路,referrer

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com