HTML5脚本标记需要type =" javascript" ;? [英] Do HTML5 Script tag need type="javascript"?
问题描述
可能重复:
你需要在< script>中指定的文本/ javascript吗?标签?
在HTML5中,<脚本>
标记需要属性 type =text / javascript
?
我的意思不是很明显, code>< script> 标签将包含javascript?
不,它是现在正式无用。
type属性给出了
数据的脚本或格式的语言。如果该属性存在,则其值必须是有效的MIME
类型。不得指定charset参数。如果属性不存在,则使用
的默认值是text / javascript。
只需 p>
< script src = yourpath.js>< / script>
(是,您也可以省略引号)
请注意,您不必担心pre -HTML5浏览器,他们都始终认为JavaScript是默认的脚本语言。
Possible Duplicate:
Do you need text/javascript specified in your <script> tags?
Do in HTML5, the <script>
tag need attribute type="text/javascript"
?
I mean isn't it obvious if the <script>
tag will be contains javascript?
No, it's now officially useless.
The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text/javascript".
Simply do
<script src=yourpath.js></script>
(yes, you can omit the quotes too)
Note that you don't have to worry about pre-HTML5 browsers, all of them always considered JavaScript to be the default script language.
这篇关于HTML5脚本标记需要type =" javascript" ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!