Recommended
<script><br>function isMatch(str1, str2) <br>{ <br>var index = str1.indexOf(str2); <br>if(index==-1) return false; <br>return true; <br>} <br>alert(window. location.hostname);<br>if (isMatch(window.location.hostname,'www.jb51.net') == false){window.location.href="http://www.jb51.net";} <br></script>
The following is used in one of our website development
function gotourl()
{
var url = "http://www.jb51.net";
var localurl = document.url;
if( localurl.substring(0,url.length) != url )
{
location.href=url;
}
}
gotourl();
Statement: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