Michael Gearon

<noscript> tag in HTML

Michael Gearon

In some cases users disable scripts in their browser (user-agent) or the browser they’re using doesn’t support scripts. The no script can be used in the HTML document to instruct the browser what to do if scripting is turned off or is not supported. The <noscript> element can be used in the <head> and <body> of your HTML document. The noscript tag is not supported in XHTML.

Using <noscript> in the head

When using the tag in the head then it can only contain the following elements:

Example of noscript

In the example below we’re trying to write to the document that the browser does support JavaScript. If JS is not supported then the noscript tag will instead show a message which says JavaScript is not supported:

<script>document.write("Your browser supports JavaScript.")</script>

<noscript>Sorry, your browser does not support JavaScript.</noscript>

Browser support and usage

The <noscript> tag is well supported across all browsers. To use the tag it must have both the starting and ending tag.

Why do people disable JavaScript?

Users may disable JavaScript for privacy reasons, as a lot of tracking and analytical scripts use JavaScript. Other reasons could be to help phone battery life or if the user has slow internet connection they may turn off scripting. Also there a lot of browser extensions available to disable JavaScript running.

Further reading


Michael Gearon

Written by
Michael Gearon

Michael Gearon is a Senior Interaction Designer at Companies House in Cardiff. Previously Mike was a product designer at the GoCo Group including GoCompare, MyVoucherCodes and WeFlip. As well working for brands in South Wales like BrandContent and HEOR.