HTML <script> Tag
<script> HTML element is intended to describe scripts; it may contain a link to the program or its text in a certain language. Scripts can be located in an external file and link to any HTML document. This approach allows you to use the same common functions on many web pages and speeds up their loading, because the external file is cached on first load, and the script is called faster on subsequent calls.
<script> can be located in the header or body of an HTML document in unlimited quantities. In most cases, the location of the script does not affect the operation of the program. However, scripts that must be executed first are usually placed in the title of the document.
- Permitted Parents
- Any element that accepts metadata content, or any element that accepts phrasing content
- Start/End Tags
- Start tag: required, End tag: required
|async||Specifies that the script is executed asynchronously (only for external scripts)|
|charset||Defines the character encoding that the script uses.|
|defer||Declares that the script will not generate any content. Therefore, the browser/user agent can continue parsing and rendering the rest of the page.|
|src||Specifies a URI/URL of an external script.|
|type||Specifies the scripting language as a content-type (MIME type).|
<script> tag also supports the Global Attributes in HTML5
<script> tag also supports the Event Attributes in HTML5
|Tablets / Mobile|