以下是Youtube视频中的嵌入代码示例:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>I AM YOUR DOCUMENT TITLE REPLACE ME</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>
<div>
<object width="1280" height="750">
<param name="movie" value="https://www.youtube-nocookie.com/v/WZ-1lfammjk?fs=1&hl=en_US&rel=0"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="https://www.youtube-nocookie.com/v/WZ-1lfammjk?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="1280" height="750"></embed>
</object>
</div>
</body>
</html>
我通过W3C HTML 4.01严格验证器,并得到以下错误:
Line 13, Column 115: end tag for element "PARAM" which is not open
Line 14, Column 55: end tag for element "PARAM" which is not open
Line 15, Column 59: end tag for element "PARAM" which is not open
Line 16, Column 16: there is no attribute "SRC"
Line 16, Column 98: there is no attribute "TYPE"
Line 16, Column 148: there is no attribute "ALLOWSCRIPTACCESS"
Line 16, Column 173: there is no attribute "ALLOWFULLSCREEN"
Line 16, Column 186: there is no attribute "WIDTH"
Line 16, Column 200: there is no attribute "HEIGHT"
Line 16, Column 205: element "EMBED" undefined
我该怎么做才能解决这个问题?我的经验有限,所以详细的答案会很棒。谢谢!
答案 0 :(得分:5)
这取决于您要验证的版本。 要检查您的代码,请使用W3CValidation Service
这是一个direct link来验证代码的一部分。
修改强>
请尝试使用此嵌入代码:
<object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="https://www.youtube-nocookie.com/v/WZ-1lfammjk?fs=1&hl=en_US&rel=0"><param name="movie" value="https://www.youtube-nocookie.com/v/WZ-1lfammjk?fs=1&hl=en_US&rel=0" /></object>
这个嵌入代码在HTML 4.01 Strict和HTML5上验证就好了。
答案 1 :(得分:1)
使用此W3C validator。确保将其验证为HTML片段,而不是整个文档。