meta标签http-equiv属性实现自动刷新页面和重定向

介绍

在meta标签的属性http-equiv属性中有refresh参数,refresh参数用于重定向和刷新页面,加入如下属性后,在content进行声明,如下:

刷新:使用该标签进行刷新页面,数字3代表若无其他操作则3秒后刷新

< meta http-equiv=“refresh” content=“3”>

重定向:3秒后跳转对应链接地址

< meta http-equiv=“refresh” content=“3;url=<%=redirectUrl%>”>

实例操作

代码部分:

<!DOCTYPE html>
	<html lang="en">
	<head>
	    <meta charset="UTF-8">
	    <title>操作失败</title>
	    <meta http-equiv="refresh" content="3;url=<%=redirectUrl%>">
	    <link rel="stylesheet" href="/admin/bootstrap/css/bootstrap.css">
	</head>
	<body>
	<!--The content below is only a placeholder and can be replaced.-->
		<div class="container" style="margin-top: 100px;width: 600px;">	    
	        <div class="alert alert-danger">            	
	            <h2><%=message%></h2>            
	            <br />                
	            <p>如果您不做出选择,将在 3秒后跳转到第一个链接地址。</p>
	        </div>
		</div>
	</body>
	</html>

版权声明:本文为liu19721018原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。