Forum Moderators: open

Message Too Old, No Replies

XHTML noscript with embedded stylesheet

XHTML noscript stylesheet

         

thetreed1

12:07 pm on Oct 13, 2006 (gmt 0)

10+ Year Member



I am having an issue with an XHTML page that I am developing. I have a link to an external css for when the page is being run without javascript. When the page is loaded and javascript IS enabled the page brings in the css defined in the noscript tag. If I put plain text inside the noscript tag and refresh the page with JS enabled, I do not see the text. When I disable JS and refresh the page I see the text.

Any clues?

TIA,
Tim

Example:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/locales/en_US.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"/schemas/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<title>some page</title>
</head>
<body>
...
<noscript>
<link rel="stylesheet" type="text/css" href="/css/noscript.css" />
</noscript>
...
</body>
</html>

choster

4:16 pm on Oct 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't believe you can put <link> elements in the <body>, but then you can't put <link> inside <noscript> either.

I'd do it the reverse of the way you have-- put the CSS relevant to both JS-enabled and -disabled users in the <link>, then use Javascript to load additional CSS dynamically for those users who have it.