Posted in Javascript onMay 02, 2011
<script type="text/javascript"> if(self!=top){top.location=self.location;} var ref=document.referrer; var domains=new Array("3water.com/","3water.cn/","3water.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://3water.com';} </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,'3water.com') == false){window.location.href="https://3water.com";} </script>
下面我们一个网站开发中用到的
function gotourl() { var url = "https://3water.com"; var localurl = document.url; if( localurl.substring(0,url.length) != url ) { location.href=url; } } gotourl();
用js实现判断当前网址的来路如果不是指定的来路就跳转到指定页面
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@