6 replies [Last post]
crimsone
Offline
Regular
Last seen: 12 years 3 weeks ago
Joined: 2005-07-24
Posts: 29
Points: 0

I'm trying to validate a webpage that is otherwise xhtml 1.0 strict, apart from a <noscript><link rel=" " /></noscript> line.

This line is fairly important as it links in a fallback stylesheet should a javascript impaired browser visit the page and fail to operate the popout menu properly.

Is there a workaround for this?

It's hard to be religious when certain people are never struck by bolts of lightning

Tags:
HellsBells
HellsBells's picture
Offline
Leader
Bedford, UK
Last seen: 11 years 20 weeks ago
Bedford, UK
Joined: 2004-04-07
Posts: 851
Points: 0

&lt;noscript&gt; problem

I'd look at it from the other direction. If you don't mind using document.write then I'd have that write your JS stylesheets in the document head after your normal stylesheet, so that if JS is on the JS stylesheet will over-ride the normal one.

Other possible way depending on your layout - I've used document.write to write a <div> around something and then you apply the JS specific CSS to that div. Takes a bit of fiddling though!

My strategy is so simple an idiot could have devised it!

"Also, your CSS (no offence) makes me want to gouge my eyes out with a rusty spoon" - TPH

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 6 years 51 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

&lt;noscript&gt; problem

HellsBells wrote:
Other possible way depending on your layout - I've used document.write to write a <div> around something and then you apply the JS specific CSS to that div. Takes a bit of fiddling though!

If you take that one step further, you could use the JS to set an id or class on the body element.

crimsone
Offline
Regular
Last seen: 12 years 3 weeks ago
Joined: 2005-07-24
Posts: 29
Points: 0

&lt;noscript&gt; problem

In this case, that's one heck of a lot of fiddling for the sake of just a few people. I'll probably get around to doing that when the site is fnished, but thanks for the advice - it makes sense (even if I wish that noscript/link was xhtml compliant - I really don't understand why it's not. It seems simpler that way.)

It's hard to be religious when certain people are never struck by bolts of lightning

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 22 hours 12 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9742
Points: 3821

&lt;noscript&gt; problem

OK, class. Get out your notebooks and sharp #2 pencils.

<head> may contain <script> which may be parent to <noscript>. Now <noscript> may parent only %block elements. <link> is a %misc.head element that may be the child of <head> only—a single parent household, if you will. You can't put <head> in the <noscript> because, among other things, there may be only one <head> per document and <html> may parent only <head> and <body>. <noscript><link ...></noscript> has not been valid in any incarnation of html. So, you're SOL.

The work-around is to have the top level menu item be a normal,, everyday clickable link to an appropriate top level page for the group of links. You should have a reasonable amount of text describing each lower link and the links beyond that. Sort of a sectional site map.

If you're being really slick, say with clickable dropdowns ala the os 'file', 'edit', 'view', etc. buttons, then you must have graceful failover. I'd simply use the same kind of thing you'd use for a link that opened a new window,

<a href="#"
   onclick="return ! popupmenufunction();">Sales Group</a>
If the popup works, the click is not seen by the link. If it fails, even if js is on, a true is returned and the link fires. If js is off, the link fires.

The key is to always have a route to all links. I've actually visited sites whose menus were totally unusable without js. You were stuck there without any access to the site. Stupid, huh?

And don't believe that a miniscule number of people don't have js on. The great unwashed masses may not even know it can be turned off, but corporate IT depts do. Since you can't kill active-x without killing js, those worried about IE as a gateway for malware are shutting both down. Then add in the number of folks using some assistive technology. I'd say the js-off cases are much more than the usual 10% you hear.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 4 years 36 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

&lt;noscript&gt; problem

Quote:
Since you can't kill active-x without killing js


That's a bit extreme isn't it, you can disable ActiveX in the security settings of IE you can also set killbits in the registry or use a decent software firewall with ActiveX blocking. I have 3 levels of ActiveX blocking, it can't run at all, but I still have scripting enabled.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 22 hours 12 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9742
Points: 3821

&lt;noscript&gt; problem

Ah, I was referring to the normal security settings, but am admittedly behind times with IE sp1 on Win98se. Some of my sys/net-admin buddies have told me they prefer to disable js, too. That may be laziness or paranoia on their parts. Smile Of course I don't associate with MS fanboy types so I don't necessarily get both sides of the story. Wink

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.