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
Since MSIE does not support JSS and Netscape ignores the tag variants, these <META> tags are of limited use.
Prev | Home | Next |
menubar | Up | META object |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |