Setting the Default Scripting Language

According to the (X)HTML specifications, if you don’t say what language you’re using for the scripts on a page, your Web page is “incorrect”. While you can use the type attribute to set the scripting language for internal and external scripts, the only mechanism for declaring the language of triggered scripts (see page 314) is with a meta tag.

To set the default scripting language:

1.
In the head section of your (X)HTML document, type <meta http-equiv=Content-Script-Type (with both hyphens).
2.
Then type content="type", where type indicates the default format and language for your scripts. Use text/javascript for JavaScript, text/vbscript for VBScript, and text/tcl for TCL.
3.
Type />.
Figure 19.20. ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.