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:


In the head section of your (X)HTML document, type <meta http-equiv=Content-Script-Type (with both hyphens).


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.


Type />.

Figure 19.20. The meta tag is always placed in the head section of your (X)HTML document. It specifies the default scripting language for all of the scripts on a page.

Figure 19.21. The result of the script itself is not changed.


  • The Content-Script-Type value sets the default scripting language for all of the scripts in a page, including the intrinsic events, internal scripts, and external scripts.

  • The scripting language indicated with the type attribute in the script tag (see page 312) overrides the meta tag specification. That means you can set the default scripting language, but still use scripts written in other languages, if desired.

  • While this meta tag is theoretically required for pages that contain intrinsic events, its absence generates no validation errors nor problems in browsers.

HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: