Detect if Javascript is disabled?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Detect if Javascript is disabled?

Post by Sindarin »

How can I detect if Javascript is disabled? The <noscript> tag works but everyone on the web says it shouldn't be used because it's a deprecated tag.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Detect if Javascript is disabled?

Post by onion2k »

Sindarin wrote:How can I detect if Javascript is disabled? The <noscript> tag works but everyone on the web says it shouldn't be used because it's a deprecated tag.
I don't think there's an alternative so I just use it regardless. I don't care what "everyone" says, I care whether or not it works.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Detect if Javascript is disabled?

Post by VladSun »

If you are going to use it server side, you may inverse it:

Code: Select all

<script src="set__js_enabled__in__session.php"></script>
;)
There are 10 types of people in this world, those who understand binary and those who don't
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Detect if Javascript is disabled?

Post by alex.barylski »

Huh...Vlad...you've done it again...such an obvious solution and yet I have always used

Code: Select all

 <noscript>  <img src="some.php" /></noscript> 
I love when solutions are simplified... :D
Post Reply