重定向到另一个页面元标记 [英] Redirecting to another page meta tag

查看:121
本文介绍了重定向到另一个页面元标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想重定向到HTML文件中的另一个页面,则必须将元标记放在中,或者可以将它放在DOCTYPE之前的文件?谢谢。

解决方案

您不能在上面放置 meta 标签DOCTYPE。 DOCTYPE必须始终是HTML文档中的第一个元素, meta 标签只能放在头部中。


文件必须由以下部分组成,按照给定的顺序:


  • 可选择单个BOM(U + FEFF)字符。

  • 任意数量的注释和空格字符。 > DOCTYPE。

  • 任意数量的注释和空格字符。

  • 根元素,以html元素的形式。

  • 任意数量的评论和空格字符。

来源: http://www.w3.org/TR/html5/syntax.html#writing



对于这个问题,规范说文档必须以DOCTYPE开头,后面跟着一个根 html 元素。虽然 meta 标签可能仍然有效,但今天并不能保证它能够这样做,并且将来也会继续这样做。


If I want to redirect to another page in my HTML file, do in have to place the meta tag in the head or can I place it at the top of the file before the DOCTYPE? Thank you.

解决方案

You can't place a meta tag above the DOCTYPE. The DOCTYPE must always be the first element in an HTML document, and meta tags must only be placed in the head.

Documents must consist of the following parts, in the given order:

  • Optionally, a single "BOM" (U+FEFF) character.
  • Any number of comments and space characters.
  • A DOCTYPE.
  • Any number of comments and space characters.
  • The root element, in the form of an html element.
  • Any number of comments and space characters.

Source: http://www.w3.org/TR/html5/syntax.html#writing

For purposes of this question, the spec says that a document must start with a DOCTYPE and be followed by a root html element. While a meta tag might still work, there is no guarantee of it doing so today and continuing to do so in the future.

这篇关于重定向到另一个页面元标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆