Skip to main content
HTML Validation

The “language” attribute on the “script” element is obsolete. Use the “type” attribute instead.

About This HTML Issue

The language attribute on the <script> element has been obsolete since HTML4 and should be removed.

Early versions of HTML used language="JavaScript" to specify the scripting language. Modern HTML defaults to JavaScript, so neither language nor type is required in most cases. The type attribute replaced language long ago, but even type="text/javascript" is unnecessary now because all browsers treat scripts as JavaScript by default.

If you do need to specify a non-JavaScript type (such as type="module" or type="application/json"), use the type attribute. Otherwise, omit both attributes entirely.

Examples

Invalid: using the obsolete language attribute

<script language="JavaScript">
  console.log("Hello");
</script>

Valid: no attribute needed for plain JavaScript

<script>
  console.log("Hello");
</script>

Valid: using type when a specific type is needed

<script type="module">
  import { greet } from "./greet.js";
  greet();
</script>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries