+ 2

Language attribute.

For the script tag, why is the language attribute no longer in use?

25th Dec 2017, 9:31 PM
Victor Jonah
Victor Jonah  - avatar
2 Réponses
+ 7
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.
25th Dec 2017, 9:34 PM
Scooby
Scooby - avatar
+ 2
I agree with SD. I just wanted to add that you should be careful when omitting quotes from attributes. This can be a problem if your path or filename has spaces in it. If working on a team, some teams follow coding practices where they require attributes to be quoted. This is likely to eliminate inconsistencies from usages and follows conventions recognized in other markup languages like XML and XHTML. I'm not saying that unquoted attributes are wrong or bad form. I'm just clarifying some additional things to consider. Here is another article on this that might be helpful to review: https://mathiasbynens.be/notes/unquoted-attribute-values
26th Dec 2017, 4:56 AM
David Carroll
David Carroll - avatar