Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <script> charset Attribute

The charset attribute on a <script> tag specifies what character set is used in the script.

If not specified, the character set will be set to UTF-8.

Example

#

A charset attribute on a <script> element.

<script src="/tutorial/script-async.js" charset="utf-8">
</script>

Using charset

The charset attribute informs the browser the character set to use.

This attribute can be specified in each page.

The default character set is UTF-8 for HTML5 documents.


Syntax

<script charset="charset">

Browser support

Here is when charset support started for each browser:

Chrome
8.0 Dec 2010
Firefox
3.6 Jan 2010
IE/Edge
10.0 Sep 2012
Opera
15.0 May 2013
Safari
5.1 Oct 2011

You may also like

 Back to <script>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides