JavaScript is determined using the source address and page 5 seconds delay jump to another page

First page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'indexTest.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
  </head>
  
  <body>
   <a href="index.jsp">跳转至index.jsp页面的超链接</a>
  </body>
</html>

Second page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
  </head>
  <body>
  	<script>
  		var preUrl=document.referrer;//通过此方法拿到跳转页面的地址
  		
  		alert(preUrl);//使用弹框输出网址
  		
  		setTimeout("javascript:location.href='test.html'",5000);//定时5秒后跳转到test.html页面
  	</script>
  </body>
</html>

Third page:

<!DOCTYPE html>
<html>
  <head>
    <title>test.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  </head>
  
  <body>
    <h1>跳转成功</h1>
  </body>
</html>

Published 108 original articles · won praise 46 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_44739706/article/details/104344688