w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



script type attribute

I. SCRIPTS:

II. DATA ISLANDS:

Examples

<scriptattribute="value(s)">...</script>Examples
5. type=MIME type<script> inline javascript statements here <⁄script> ⁄⁄ INLINE script
<script type="application/javascript"> inline javascript statements here <⁄script> ⁄⁄ INLINE script
<script src="file.js" type="application/javascript"> <⁄script> ⁄⁄ EXTERNAL script
<script type="text/xml"> inline xml goes here <⁄script> ⁄⁄ DATA ISLAND
<script type="text/plain"> inline plain text goes here <⁄script> ⁄⁄ DATA ISLAND

Video demonstration script type attribute

HTML5 script type attribute, Tutorial

min video details
00:06 the type attribute on the script element allows you to:
00:06 1. specify the language of the INLINE script
00:09 2. specify the language of the EXTERNAL script
00:12 3. specify the format type of the STORED DATA (data islands)
00:24 1. the language of this INLINE script is JavaScript;
corresponding MIME type: text/javascript
00:35 2. the language of this EXTERNAL script is JavaScript;
corresponding MIME type: text/javascript
00:46 3. the format type of the stored data is: xml;
corresponding MIME type: text/xml
00:59 Case: INLINE and EXTERNAL SCRIPTS

- the type attribute may be omitted if the scripting language is JavaScript (text/javascript) represents the default MIME type
01:07 Case: DATA ISLANDS:

- the type attribute is required
01:11 Case: INLINE SCRIPTS and DATA ISLANDS

- the charset attribute must be specified (because src attribute absent)
script intro script inline, imported, data islands script browser display script parents - script statements script syntaxscript async attributescript charset attributescript defer attributescript src attribute