用JS判断当前域名并跳转到指定页面
摘要:
用JS判断当前域名并跳转到指定页面var currentUrl = location.href ;
用JS判断当前域名并跳转到指定页面
<script type="text/javascript"> var currentUrl = location.href ; if(currentUrl.indexOf("d1blog.com")==-1){ //跳转 location.href = "https://www.d1blog.com/"; }else{ // 为了调试 下面这个可以不用管 console.log(currentUrl); } </script>
本文由 帝一博客 原创发布。用户在本站发布的原创内容(包括但不仅限于回答、文章和评论),著作权均归用户本人所有。独家文章转载,请联系邮箱:17762131@qq.com。获得授权后,须注明本文地址: https://bubukou.com/autojs/2003.html
网友留言评论