<script>

  • Revision slug: HTML/Element/Script
  • Revision title: script
  • Revision id: 45684
  • Created:
  • Creator: PGaries
  • Is current revision? No
  • Comment 135 words added, 77 words removed

Revision Content

Summary

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

Attributes

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.1") }}
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;"><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.1") }}</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