我使用的一个应用程序有一个 PL/SQL 包,它创建一个页面并使用一个函数来创建 META 标签。
它创建一个带有 META 标签的网页,就像这样:
<META HTTP-EQUIV="Refresh" NAME="Refresh" CONTENT="1; URL=PaymentSubmit.html">
问题是 Chrome 不喜欢 NAME="Refresh"属性。它不重定向页面,尽管它在 IE 和 Firefox 中正确重定向
如果我删除 NAME 属性,它看起来像这样它在所有浏览器中都可以工作:
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=PaymentSubmit.html">
这是怎么回事?我找不到用于 META 重定向的 W3C 标准,那么每个浏览器是否都制定了自己的规则?我不确定它是否曾在 Chrome 中运行过,但由于我从未听说过任何错误报告,我认为它曾经在 Chrome 中运行过。
有人遇到过类似的问题吗?
谢谢
最佳答案
如果你勾选the w3c wiki你可以找到以下引述:
Exactly one of the name, http-equiv, and charset attributes must be specified.
这意味着设置了 name
和 http-equiv
属性不是有效的 html。
阅读this W3C's HTML and XHTML Techniques test on meta refresh :
Find all meta elements in the document. For each meta element, check if it contains the attribute http-equiv with value "refresh" (case-insensitive) and the content attribute with a number greater than 0 followed by ;'URL=anyURL' (where anyURL stands for the URI that should replace the current page).
其他浏览器的行为没有错,但chrome更严格。
有关正确行为和有效引用的更多详细信息,请访问 http://www.w3.org/TR/html5/document-metadata.html#attr-meta-http-equiv-refresh。
关于html - 为什么 Chrome 不使用元刷新重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22551976/