could someone help me in figuring out how to detect if javascript is turned off.
Im guessing one could do it with javascript because javascript is a client-side language, but if the javascript is turned off wont it never be executed to check if the javascript is turned off?
Hopefully, someone can help me with this perplexing problem. And i know that one should not design their site necessarily based on js and i have the content and structure if js is off, but i just want to make sure so that everything that can be displayed with the js is displayed if js in on.
I hope i didn’t confuse anybody. And please reply with any questions, comments, concerns, or solutions
The <noscript> tag basically became unnecessary about 6 years ago. Since then it has required less code to omit those tags and use JavaScript to hide the content if JavaScript is enabled. This also has the benefit that you can hide inline content whereas the noscript tag is a block level tag. It also has the benefit that you can test if specific JavaScript commands are supported rather than just whether JavaScript itself is available and so still present the static content to those who have a browser that doesn’t have a sufficiently up to date version of JavaScript for your script to work.
My earlier example in this thread showed using JavaScript to hide one word if JavaScript is enabled. The code to do the same thing using the noscript tag involves about twice as much code.
The one exception to noscript being useless would be wrapping it around some CSS in the head of the page. You can’t do that with HTML 4 since noscript is currently only valid in the body. HTML 5 has expansded the use of noscript to allow it in the head and will presumably disallow its use in the body as a future amendment to the draft.
69+ downloads doesn’t mean 69+ computers with noScript installed. I bet half of downoad ar just for testing this addon or same user downloaded twice and so on… noScript doesn’t mean js turned off.
Agree with JesseDPate. Anyway, you always shoud provide a fallback scenario in case js is turn off. But this is not a major problem. Few peoples have js off.
If JS is on, then the JS will run. If JS is off, then it will not run. The only thing you can do for people without JS on is add a few <noscript> tags with alternate content.
As i might have mentioned before, i made a carosel for my site so that the intro, 360 view, and some pictures are rotated as content for the home.
with your help and without using the <noscript> tag, I reconfigered the js so that no matter when javascript is disabled, be it before or while the carosel is running, then it will display the first slide which is the introduction and does not need javascript to run.
In other words.
Slide 1: no js needed if js is disabled then everything past this does not happen.
transition:js needed
Slide 2:js needed
transition:js needed
Slide 3: no js needed and is not essential content.
Regarding what felgall said here:
HTML 4 since noscript is currently only valid in the body. HTML 5 has expansded the use of noscript to allow it in the head
Then the way to make your document html5 is by changing the doctype correct?
Also, I agree i have not seen noscript is a a while, that is why i forgot about it, but I swear i have seen it in html4 documents. Anyway, I too concur that it should only be used in the head where all <script> and <link< tags ought to be.
Statistics show that anything between 5-10% of all Internet usage involves a user or browser or device which has scripting either unavailable or disabled. As for NoScript, it DOES mean JavaScript is turned off, that’s the whole point of the extension… to cripple scripting unless specified as an exception.
There’s Conditional Compilation, it would work for Internet Explorer only (so if their using IE, the script won’t do anything - kinda like conditional comments), but it won’t work for other browsers, and you REALLY don’t want to go down the road of having browser specific JavaScript (it’s the pinnacle of unprofessional).