网站跳转的几种实现方法
2016-08-21 17:49
246 查看
网站跳转的几种实现方法
一、初级使用方法
使用setTimeout()方法,设置跳转时间为0秒,
二、高级使用方法
使用window.location.host获取当前域名,用if判断要不要跳转
附件:
强制设置页面为指定页面的方法:
一、初级使用方法
使用setTimeout()方法,设置跳转时间为0秒,
<script> setTimeout(function(){alert("判断网站域名并决定是否要跳转") },0); </script>
二、高级使用方法
使用window.location.host获取当前域名,用if判断要不要跳转
<script> var hhost=window.location.host; if(hhost=="www.baidu.com"){ setTimeout(function(){ alert("判断网站域名并决定是否要跳转") },6000); } </script>
附件:
强制设置页面为指定页面的方法:
<script> setTimeout(function(){ document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.min.css\" />"); document.writeln("<div class=\"embed-responsive embed-responsive-16by9\">"); document.writeln("<iframe src=\"http://www.baidu.com/\" class=\"embed-responsive-item\"></iframe>"); document.writeln("</div>"); },0); </script>
相关文章推荐
- 网站登录记忆跳转实现的一种方法
- 利用javascript实现页面跳转的几种方法
- PHP页面跳转几种实现方法
- 网站页面自动跳转实现方法PHP、JSP(上)
- JSP页面跳转的几种实现方法
- 页面自动跳转的几种实现方法
- 在PB中用Enter键实现跳转的几种方法
- 网站登录记忆跳转实现的一种方法
- 利用javascript实现页面跳转的几种方法
- 【PB】在PB中用Enter键实现跳转的几种方法
- 一个空间绑定多个域名实现自动跳转的几种方法!
- 网站页面自动跳转实现方法PHP、JSP(上)
- 页面自动跳转的几种实现方法
- php页面跳转的几种实现方法
- 页面自动跳转的几种实现方法
- 网站页面自动跳转实现方法PHP、JSP等
- 网站页面自动跳转实现方法PHP、JSP(下)
- 网站页面自动跳转实现方法PHP、JSP(下)
- PHP页面跳转几种实现方法
- JS实现网页跳转的几种方法