...">

Noscript alternative in XHTML?

In HTML, I could do:

<noscript><link href="css/stylenojs.css" rel="stylesheet" type="text/css" /></noscript>

Is there any compatible way to do this in XHTML Transitional or Strict documents?

+3
source share
2 answers

The example below is not valid in HTML as well as in XHTML. No current recommendation makes it possible to include a stylesheet, unless scripting is included.

In general, you should avoid <noscript>. Start with what works and then build on it.

In this case, you can write your stylesheet for clients other than JS, and then:

<body>
<script type="text/javascript">document.body.className += ' js';</script>

... and include additional JS-specific rule sets with:

body.js foo {
}

Alternatively, you can do something like:

<link href="css/stylenojs.css" rel="stylesheet" type="text/css" id="nojscss" />

and

var nojscss = document.getElementById('nojscss');
nojscss.parentNode.removeChild(nojscss);
+3
source

.

<noscript> HTML , , .

W3C :

noscript HTML, XHTML. , , "" , , , . XML .

XHTML , XHTML XML, application/xhtml+xml, MIME.

XHTML, doctype HTML5 MIME text/html.

+1

Source: https://habr.com/ru/post/1790076/


All Articles