XHTML Mobile 1.2 - 由于 Target _blank,W3C 验证无效

发布于 2024-12-18 07:39:58 字数 797 浏览 3 评论 0原文

我的移动网站上有一个异地目标(位置地址会转到它的谷歌地图),因此我将链接定位为_blank,以便用户在执行此操作时不会丢失该网站。

但似乎 target="_blank" 对于 W3C 无效......

第 56 行,第 288 列:没有属性“target” …0.018282&z=16&iwloc=A" target="_blank" class="adress">地址…

您已在文档中使用了上述属性,但您使用的文档类型不支持该元素的该属性。此错误通常是由于错误地将“严格”文档类型与使用框架的文档一起使用(例如,您必须使用“过渡”文档类型来获取“目标”属性),或者使用供应商专有扩展(例如“ marginheight”(这通常通过使用 CSS 来修复以达到所需的效果)。

如果您正在使用的文档类型不支持该元素本身,也可能会导致此错误,因为未定义的元素将没有受支持的属性;在这种情况下,请参阅元素未定义错误消息以获取更多信息。

如何修复:检查元素和属性的拼写和大小写(记住 XHTML 都是小写)和/或检查它们是否在所选文档类型中都允许,和/或使用 CSS 代替属性。如果您在使用该元素将 Flash 媒体合并到网页中时收到此错误,请参阅有关有效 Flash 的常见问题解答项目。

我使用的是 XHTML Mobile 1.2,因为那是一个移动网站(所以我几乎无法对此进行更改)。有没有有效的方法将该属性放入 XHTML Mobile 1.2 中?

已经尝试切换到 XHTML Transitional,但我失去了网站的一些功能。所以这几乎是问题的一部分。

I'm having a target that goes offsite on my mobile website (address of location goes to a google maps of it) so I target _blank the link so users don't lose the site while doing this.

But it seems target="_blank" is invalid for the W3C...

Line 56, Column 288: there is no attribute "target"
…0.018282&z=16&iwloc=A" target="_blank" class="adress">Adress…

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the element to incorporate flash media in a Web page, see the FAQ item on valid flash.

I'm in XHTML Mobile 1.2, because that's a mobile Website (so I pretty much can't change from that). Is there a valid way to put in that property in XHTML Mobile 1.2?

Already tried to switch to XHTML Transitional, but I'm losing a couple of functionalities of the website doing that. So it's pretty much ot of the question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谜兔 2024-12-25 07:39:58

在 XHTML Strict 等中,target 不是有效的属性。您应该使用 rel="external",而不是 target="_blank"。我不知道移动浏览器上的支持有多广泛,但如果您应该遵守 Mobile Profile 1.x 标准,那么您就应该这样做。在这种情况下,您可能需要使用 JavaScript 来获得所需的行为。

In XHTML Strict et al., target is not a valid attribute. Instead of target="_blank" you are supposed to use rel="external". I have no idea how widely supported that is on mobile browsers, but if you're supposed to adhere to the Mobile Profile 1.x standard, that's what you're supposed to do. You may need to use JavaScript to get the desired behavior in this case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文