如果我想在HTML文件中重定向到另一个页面,我必须将meta标签放在中吗?还是可以将其放在DOCTYPE之前的文件顶部?谢谢。
W3C已经弃用了它,但是他们在W3C上提供了一个例子:
<HEAD>
<TITLE>Don't use this!</TITLE>
<META http-equiv="refresh" content="5;http://www.example.com/newpage">
</HEAD>
<BODY>
<P>If your browser supports Refresh, you'll be transported to our
<A href="http://www.example.com/newpage">new site</A>
in 5 seconds, otherwise, select the link manually.
</BODY>
你应该在HTML页面的head部分插入以下行,将http:example.com/替换为要重定向观众到的实际网页:
< meta http-equiv="refresh" content="2;url=http://example.com/" />
以下是一个示例,其中正确的行已插入典型的HTML页面中。请注意它位于标题标签之上。
<html>
<head>
<meta http-equiv="refresh" content="2;url=http://example.com" />
<title>Page Moved</title>
</head>
<body>
This page has moved. Click <a href="http://www.example.com">here</a> to go to the new page.
</body>
</html>