Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is <META HTTP-EQUIV="Content-Script-Type" ...> mostly unused?

Tags:

html

html4

People also ask

What is HTTP-equiv content type?

http-equiv = "content-type" Indicates that the meta element is in the encoding declaration state and represents a character encoding declaration. content = meta-charset string. A specially formatted string providing a character encoding name.

What is the use of meta HTTP-equiv?

The http-equiv attribute provides an HTTP header for the information/value of the content attribute. The http-equiv attribute can be used to simulate an HTTP response header.

Is HTTP-equiv necessary?

The http-equiv element is considered obsolete and should not be used. To specify the content type of a document, use the charset attribute of the meta element instead.

What are valid values of HTTP-equiv?

http-equiv valuescontent-security-policy. content-length. content-encoding. default-style.


According to W3C, http-equiv values "content-style-type" & "content-script-type" attributes are unknown for HTML5 meta markup! Moreover, W3C validator throws the following error when an HTML5 page has such markups:

Line X, Column Y: Bad value Content-Script-Type for attribute http-equiv on element meta.

<meta http-equiv="Content-Script-Type" content="text/javascript">

So essentially we are supposed to avoid them.


All web browsers that I've heard of will default to assuming type="text/javascript" on all <script> tags, and type="text/css" on <style> tags. (The only meaningful alternative I've heard of is VBScript for <script> tags in MSIE, which is heavily deprecated. There's no alternative to CSS.) In recognition of this, the HTML5 spec defines both attributes as being newly optional.

As such, there's no point in the Content-Script-Type and Content-Style-Type meta tags -- as far as I'm aware, they're ignored by most, if not all, browsers.


It's a shame that these settings have become deprecated with HTML5. Because, as nobody else seems to be mentioning, you can put default character set settings in there as well! Thus:

<meta http-equiv="Content-Script-Type" content="text/javascript; charset=UTF-8;"> <meta http-equiv="Content-Style-Type" content="text/css; charset=UTF-8;">


Speaking as a developer who just learned about these tags from your question, I'd say that it's the curse of the legacy browsers (I'm looking at you, IE6). Because when I learn about new tags, I usually continue not using them. I always assume browsers might not support any feature that I've never heard of, until I prove otherwise (which takes time), and since you have to program to the least common denominator (even if you "progressively enhance" later), that means, in this case, using the safer, more verbose method.

Having said that, I may actually give these a try. There's little risk, unless you're using content types other than text/javascript and text/css, since those have been the assumed defaults, like, forever. Indeed, as @duskwuff points out, there's probably no point in using either.


<meta http-equiv="Content-Style-Type" content="text/css; charset=UTF-8;">

The CSS meta is important for inline styles where we can't declare the type, so:

<span style="background:pink">