traq
06-16-2010, 07:29 PM
hi all,
I've been experimenting more lately with javascript. Because of my current clientele (corporate - read: old computers/browsers), I'm trying to keep everything as degrade-able as possible.
In some cases, I need to hide stuff when there's no javascript - essentially, items that won't be used (and would be in the way) if javascript isn't on.
I've been using noscript tags to hold html comments, like so:
<noscript> <!-- </noscript>
<div>This div should be hidden if javascript is disabled, but visible if javascript is on.</div>
<noscript> --> </noscript>
I thought that was "the" solution, but I've come across situations where it doesn't seem to work. In Chrome, for example, the comment tag actually comments out the closing noscript tag, making the div inside always hidden.
Any solutions?
In this particular example, the div is an overlay that hides the entire page and then fades out - basically a flash-style intro.
My alternative is to have the div hidden when the page loads and show it via javascipt, but I don't want to risk seeing the content that's supposed to be hidden while waiting for the javascript to run on an older machine.
Thanks, everyone.
I've been experimenting more lately with javascript. Because of my current clientele (corporate - read: old computers/browsers), I'm trying to keep everything as degrade-able as possible.
In some cases, I need to hide stuff when there's no javascript - essentially, items that won't be used (and would be in the way) if javascript isn't on.
I've been using noscript tags to hold html comments, like so:
<noscript> <!-- </noscript>
<div>This div should be hidden if javascript is disabled, but visible if javascript is on.</div>
<noscript> --> </noscript>
I thought that was "the" solution, but I've come across situations where it doesn't seem to work. In Chrome, for example, the comment tag actually comments out the closing noscript tag, making the div inside always hidden.
Any solutions?
In this particular example, the div is an overlay that hides the entire page and then fades out - basically a flash-style intro.
My alternative is to have the div hidden when the page loads and show it via javascipt, but I don't want to risk seeing the content that's supposed to be hidden while waiting for the javascript to run on an older machine.
Thanks, everyone.