Home >Web Front-end >HTML Tutorial >Several methods of page redirection

Several methods of page redirection

高洛峰
高洛峰Original
2016-10-11 13:07:30904browse

最近在开发项目时候,由于同事运用CMS模板建站,但是不想用户访问模板文件

 就这个问题,我想到了几种方法,下面将这几种方法分享给大家

希望大家再接再厉 努力奋斗 为程序献上自己的一份力

废话不多说了 干活直接上

 

JS实现页面重定向

第一种:

<script language="javascript"type="text/javascript"> 
window.location.href="http://shanghepinpai.com"; 
</script>

第二种:

<script language="javascript"> 
alert("返回"); 
window.history.back(-1); 
</script>

第三种:

<script language="javascript"> 
window.navigate("http://shanghepinpai.com"); 
</script

第四种:

<script language="JavaScript"> 
self.location=&#39;http://shanghepinpai.com&#39;; 
</script>

 第五种:

<script language="javascript"> 
alert("非法访问!"); 
top.location=&#39;http://shanghepinpai.com&#39;; 
</script>

html中meta标签实现

只需在head里加上下面这一句就行了,在当前页面停留0.1秒后跳转到目标页面

 

 

php实现

<?php
    header("Location: http://jb51.net/");
?>


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