w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



script charset attribute

The charset attribute on the script element:

!Observations

Examples

<scriptattribute="value(s)">...</script>Examples
2.charset=character encoding name<script src="jsfile.js" charset="UTF-8"> <⁄script>
<script src="jsfile.js" charset="utf-8"> <⁄script>
<script src="http://domain.com/jsfile.js" charset="utf-8"> <⁄script>

Video demonstration script charset attribute

HTML5 script charset attribute, Tutorial

min video details
00:04 the charset attribute on the script element allows you to specify the character encoding set of the external script file linked to your HTML5 document
00:08 the external script file linked to our HTML5 document: file.js
00:12 this means that the charset attribute cannot be specified in the absence of the src attribute
00:18 the character encoding set of the external script file, file.js is: UTF-8
00:33 the external script file, file.js, linked to the html page is UTF-8 encoded, aspect specified through the charset attribute

For more information about Encoding, please see the specs: W3C

script intro script inline, imported, data islands script browser display script parents - script statements script syntaxscript async attributescript defer attributescript type attributescript src attribute