最近在開發項目時候,由於同事運用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='http://shanghepinpai.com';
</script>
第五種:
<script language="javascript">
alert("非法訪問!");
top.location='http://shanghepinpai.com';
</script>
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/");
?>
header("Location: http://jb51.net/");
?>