mozilla

Revision 45692 of <script>

  • Revision slug: HTML/Element/Script
  • Revision title: script
  • Revision id: 45692
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 68 words added

Revision Content

Summary

The script element is used to embed or reference an executable script within an HTML or XHTML document.

Attributes

async {{ gecko_minversion_inline("1.9.2") }}
This Boolean attribute is set (to the value async) to indicate that the browser should, if possible, execute the script asynchronously. If the script cannot be executed asynchronously, or the browser doesn't support this attribute, the script is executed synchronously (and loading the content blocks until the script finishes running).
src
This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a document. script elements with an src attribute specified should not have a script embedded within its tags.
type
This attribute identifies the scripting language of code embedded within a script element or referenced via the element’s src attribute. This is specified as a MIME type; examples of supported MIME types include text/javascript, text/ecmascript, application/javascript, and application/ecmascript. This attribute must be specified per various HTML and XHTML DTDs.
language {{ Deprecated_inline() }}
Like the type attribute, this attribute identifies the scripting language in use. Unlike the type attribute, however, this attribute’s possible values were never standardized. The type attribute should be used instead.
defer {{ fx_minversion_inline("3.5") }}
This Boolean attribute is set (to the value defer) to indicate to a browser that it may continue parsing and rendering a document without waiting for a script to be executed. Since this feature is optional, authors should not assume that the script’s execution will actually be deferred.

Revision Source

<h3 id="Summary" name="Summary">Summary</h3>
<p>The <code>script</code> element is used to embed or reference an executable script within an <abbr>HTML</abbr> or <abbr>XHTML</abbr> document.</p>
<ul> <li>Element Type: <a href="/en/HTML/Block-level_elements" title="en/HTML/Block-level_elements">block‐level</a></li> <li>Allowed Content: script content</li>
</ul>
<h3 id="Attributes" name="Attributes">Attributes</h3>
<dl> <dt style="margin-top: 1em;">async {{ gecko_minversion_inline("1.9.2") }}</dt> <dd>This Boolean attribute is set (to the value <code>async</code>) to indicate that the browser should, if possible, execute the script asynchronously. If the script cannot be executed asynchronously, or the browser doesn't support this attribute, the script is executed synchronously (and loading the content blocks until the script finishes running).</dd> <dt style="margin-top: 1em;"><code>src</code></dt> <dd>This attribute specifies the <abbr>URI</abbr> of an external script; this can be used as an alternative to embedding a script directly within a document. <code>script</code> elements with an <code>src</code> attribute specified should not have a script embedded within its tags.</dd> <dt style="margin-top: 1em;"><code>type</code></dt> <dd>This attribute identifies the scripting language of code embedded within a <code>script</code> element or referenced via the element’s <code>src</code> attribute. This is specified as a <abbr>MIME type; examples of supported <abbr>MIME types include <code>text/javascript</code>, <code>text/ecmascript</code>, <code>application/javascript</code>, and <code>application/ecmascript</code>. This attribute must be specified per various <abbr>HTML and <abbr>XHTML <abbr>DTDs. </abbr></abbr></abbr></abbr></abbr></dd> <dt style="margin-top: 1em;"><code>language</code> {{ Deprecated_inline() }}</dt> <dd>Like the <code>type</code> attribute, this attribute identifies the scripting language in use. Unlike the <code>type</code> attribute, however, this attribute’s possible values were never standardized. The <code>type</code> attribute should be used instead.</dd> <dt style="margin-top: 1em;"><code>defer</code> {{ fx_minversion_inline("3.5") }}</dt> <dd>This Boolean attribute is set (to the value <code>defer</code>) to indicate to a browser that it <strong>may</strong> continue parsing and rendering a document without waiting for a script to be executed. Since this feature is optional, authors should not assume that the script’s execution will actually be deferred.</dd>
</dl>
Revert to this revision