頁面重定向的幾種方法

最近在開發項目時候,因爲同事運用CMS模板建站,可是不想用戶訪問模板文件javascript

 就這個問題,我想到了幾種方法,下面將這幾種方法分享給你們php

但願你們再接再礪 努力奮鬥 爲程序獻上本身的一份力html

廢話很少說了 幹活直接上java

 

JS實現頁面重定向ui

第一種:url

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

第二種:.net

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

第三種:htm

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

第四種:

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

 第五種:

<script language="javascript"> 
alert("非法訪問!"); 
top.location='http://shanghepinpai.com'; 
</script> 
 
html中meta標籤實現

只需在head里加上下面這一句就好了,在當前頁面停留0.1秒後跳轉到目標頁面

<meta http-equiv="refresh" content="0.1; url=http://jb51.net/">
 
 
php實現
<?php
    header("Location: http://jb51.net/");
?>
相關文章
相關標籤/搜索