<META> (HTML Tag)

Document meta-information container.

Availability:

JavaScript - 1.2
Netscape - 4.0
HTML syntax:<META HTTP-EQUIV="aName" CONTENT="aValue">
Argument list:aNameA pseudo header name
aValueA pseudo header value

The <META> tag is a way of adding information about the document to the document. This information is never intended for display to the user but helps the browser and other server side systems (and proxies) to manage the document.

There are many attributes to the <META> tag. We have only covered the ones that are helpful in the context of script development here.

The items that are particularly useful to us are the HTTP_EQUIV and CONTENT attributes. These are used to add information to the HTTP response body. The browser can see these values in the <META> tag and interprets them as if they had been part of the HTTP header.

So:

<META HTTP-EQUIV="name" CONTENT="value">

is understood to be equivalent to an HTTP header like this:

name: value

As far as JavaScript is concerned, there are two <META> tags that are useful.

This one defines the default scripting language:

<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/JavaScript">

If you have access to the server mechanism, you might be able to effect the same things by forcing it to add this header to the response as it goes out:

Content-Script-Type: text/JavaScript

The second useful <META> tag is used to define the default style definition language. Given all the warnings about JSS not being portable and it having been deprecated, you could use this in your document <HEAD> block:

<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/JavaScript">

Again, if you have access to the server mechanism, you might be able to add this header to the response as it goes out:

Content-Style-Type: text/JavaScript

Warnings:

See also:<SCRIPT LANGUAGE="...">, <SCRIPT>, <STYLE TYPE="...">, <STYLE>, JavaScript Style Sheets, META object

Cross-references:

Wrox Instant JavaScript - page - 52