Steve
Steve

Reputation: 5923

<noscript> in <head>

Am I allowed to place <noscript> in the <head>?

Upvotes: 33

Views: 14812

Answers (5)

Ric Paton
Ric Paton

Reputation: 61

Found this while searching for a similar thing, thought I'd provide a 2023 update.

As part of the HTML5 W3C spec, you can place a <noscript> tag within the <head>.

"In a head element of an HTML document, if there are no ancestor noscript elements."

Upvotes: 0

Luke
Luke

Reputation: 2454

HTML5 adds support to <noscript> in the <head>: https://www.w3schools.com/tags/tag_noscript.asp

Upvotes: 1

Oriol
Oriol

Reputation: 12650

You are as long as you do it in HTML documents and not XHTML.

In a head element [...], the noscript element must contain only link, style, and meta elements.

See specification.

Upvotes: 2

Kevin C.
Kevin C.

Reputation: 2527

Using the HTML5 Doctype, I have a declaration in my <head> with a <link> element that points to a no-js.css stylesheet. It validates and seems to work fine.

Upvotes: 22

Greg
Greg

Reputation: 321578

According to the XHTML Strict DTD, no, you're allowed script, style, meta, link, object, title and base only. Transitional allows isindex as well, but still not noscript.

Upvotes: 25

Related Questions