window.open()
打开新页面并跳转
window.location.href=""
在本页面跳转
<html>
<head>
<script language="javascript">
var newWindow = window.open(document.URL);
setTimeout('newWindow.close()', 1000);
setTimeout('window.close()', 2000)
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<!-- 方案一 -->
<meta http-equiv="refresh" content="2;url=https://www.baidu.com" />
</head>
<body>
<!-- 方案二 -->
<a href="https://www.baidu.com/">go</a>
<script language="javascript" type="text/javascript">
// 方案三
// 打开新窗口并跳转
window.open('https://www.baidu.com/', 'newwindow')
// 方案四
// 以下方式直接跳转
window.location.href = 'https://www.baidu.com/';
// 方案五
// 五秒以后再跳转
setTimeout("javascript:location.href='https://www.baidu.com'", 5000);
</script>
</bod>
</html>
window.open() 返回一个window 对象