An HTML 4.0 compliant Web browser that cannot render scripts must render contents of a <noscript>
element. Compliant Web browsers that can render scripts should render contents of a <noscript>
element when scripting is disabled.
The standard also says Web browsers should render <noscript>
after a script it could not render earlier in a document. This feature is of questionable desirability, and is rarely observed in practice.
The type
attribute specifies the content type of a script (that is, what language the script is in).
On 27 June 2005, the IETF has at last registered content types for JavaScript, application/javascript
, application/ecmascript
, text/javascript
(marked obsolete), and text/ecmascript
(marked obsolete). Examples in the HTML 4.0 specification incorrectly used then‐unregistered content type text/javascript
for JavaScript instead of well‐established though unofficial content type application/x-javascript
. Using a subtype of text
for code to be executed instead of text for humans to read was a mistake and can cause problems. Examples also incorrectly use text/vbscript
(instead of application/x-vbscript
) and text/tcl
(instead of application/x-tcl
).
The type
attribute replaces the ill‐defined language
attribute used by older browsers. HTML 4.0 simultaneously introduces language
for compatibility, and deprecates it in favor of type
.
This Web browser executes scripts with these valid content types:
This Web browser executes scripts with these valid, obsolete content types:
This Web browser executes scripts with these unregistered content types:
Related Mozilla bug reports: text-ecmascript.
The defer
attribute marks scripts that may be executed after the rest of a page has finished rendering. It is used for scripts that do not generate document content (using methods like document.writeln()
functions in the scripts above).
Deferring document.writeln()
functions until a page is fully loaded would cause generated content to be appended to the end of the page. However, one could defer a script that used DOM methods to insert content within a particular element in a document.
Related Mozilla bug reports: Defer.
Related Internet Explorer bug reports: Channel9 Wiki: Internet Explorer Standards Support.