31

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

4

4 回答 4

24

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.

于 2008-10-31T08:47:54.157 回答
21

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.

于 2011-12-21T20:08:03.413 回答
1

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.

于 2016-01-15T23:55:45.533 回答
1

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

于 2019-10-16T20:29:50.217 回答