错误验证W3C HTML5 img noscript facebook.com [英] Errors validation W3C HTML5 img noscript facebook.com
问题描述
我正在尝试将我的页面验证为HTML 5(W3c)。我有以下错误:这里不允许使用img元素(作为noscript元素的子元素)。当head的子元素时,noscript元素必须只包含以下子元素:link,style和meta。
I am trying to validate my page as HTML 5 (W3c). And I have the following error: The "img" element is not allowed here (as a child of the "noscript" element). The "noscript" element, when a child of "head", must contain only the following child elements: "link", "style", and "meta".
现场 https://developers.facebook.com/docs / ads-for-websites / conversion-pixel-code-migration 推荐我的代码:
将升级的代码段复制并粘贴到< head> $ c之间$ c>;以及
< / head>
;在您要跟踪转化的网站的HTML代码中。例如,要跟踪注册,请将代码放在您的网站上'注册完成'网页。
On site https://developers.facebook.com/docs/ads-for-websites/conversion-pixel-code-migration recommendation for my code:
"Copy and paste the upgraded code snippet between <head>
; and </head>
; in the HTML code of your website where you want to track conversions. For example, to track registrations, place the code on your 'registration completed' web page."
请参阅源代码:
<head>
<script type="text/javascript">
var fb_param = {};
fb_param.pixel_id = '1234567890';
fb_param.value = '10.00';
fb_param.currency = 'USD';
(function(){
var fpw = document.createElement('script');
fpw.async = true;
fpw.src = '//connect.facebook.net/en_US/fp.js';
var ref = document.getElementsByTagName('script')[0];
ref.parentNode.insertBefore(fpw, ref);
})();
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/offsite_event.php?id=1234567890&value=10.00¤cy=USD" /></noscript>
</head>
是否可以修改此代码并通过验证(在头部)?
Is it possible to modify this code and pass validation (in head section)?
推荐答案
W3C的HTML5规范定义了头中的html5-20141028 / scripting-1.html #the-noscript-elementrel =nofollow> noscript
元素 这样的元素:
W3C’s HTML5 specification defines the content model of a noscript
element in the head
element like this:
[...]任何顺序,零个或多个
链接
元素,零个或多个样式
元素,零个或多个元
元素。
[…] in any order, zero or more
link
elements, zero or morestyle
elements, and zero or moremeta
elements.
如您所见,除了 link
/ <$ c之外,它不能包含任何其他内容$ c> style / meta
元素。所以不,在<$ c里面的 noscript
元素内修改任何东西都不可能允许 img
$ c> head 元素。
As you can see, it cannot contain anything else than link
/style
/meta
elements. So no, it’s not possible to modify anything to allow an img
inside of a noscript
element inside of the head
element.
但是你可以在 img
里面code> noscript 如果你将 noscript
元素放在正文
中,在这种情况下,内容模型是:
But you can have an img
inside of noscript
if you place the noscript
element in the body
, as the content model is in that case:
透明,但必须没有
noscript
元素后代。
透明表示它与其父元素具有相同的内容模型。因此,例如,如果 noscript
位于 div
内,它可能包含的任何内容div
可能包含(除了另一个 noscript
)。
Transparent means that it has the same content model as its parent element. So for example, if the noscript
is inside a div
, it may contain anything that a div
may contain (except of another noscript
).
这篇关于错误验证W3C HTML5 img noscript facebook.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!