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

Several methods of page redirection

高洛峰
Release: 2016-10-11 13:07:30
Original
887 people have browsed it

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

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

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

废话不多说了 干活直接上

 

JS实现页面重定向

第一种:

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

第二种:

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

第三种:

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

第四种:

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

第五种:

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

html中meta标签实现

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

php实现

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


Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template