网页跳转的几种方式

立即跳转

<?php header("location:1.php"); ?>

延迟跳转,1秒跳转

<?php header('Refresh:1;url=1.php'); ?>

<?php sleep(3); header("location:1.php"); ?>

js延迟跳转

setTimeout("window.location.href='1.php'",3000);

window.location.assign('1.php');

js原窗口打开,不能后退

window.location.replace('1.php');

三个参数:1、url地址;2、打开方式(例新页面_blank,_new,自身跳转_self);3、是新页面的样式等。

window.open('1.php',_blank,width=300px);

HTML 3秒跳转

<meta http-equiv="refresh" content="3;url='1.php'">

 

原地址刷新

1、history.go(0) 
2、location.reload() 
3、location=location 
4、location.assign(location) 
5、document.execCommand('Refresh') 
6、window.navigate(location) 
7、location.replace(location) 
8、document.URL=location.href

posted @ 2020-11-10 14:03  棉花糖88  阅读(1039)  评论(0编辑  收藏  举报