[SOLVED] Detect if javascript enabled

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Detect if javascript enabled

Post by anjanesh »

Hi
Is there any way to detect if javascript enabled ? Is this possible in PHP ? $_SERVER gives the server info but how about the client's ? (equivalent of $_CLIENT ?)
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<script language="Javascript">document.write('<img src="imagescript.php?javascript=yes" />');</script><noscript><img src="imagescript.php?javascript=no" /></noscript>
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

This is good enough. I just thought there was some constant in one of the suerglobals but I guess not.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's data returned by [php_man]get_browser[/php_man] that will tell you if the user agent string suggests a browser that supports javascript, but it can't identify if the browser has the feature turned on..
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

[SOLVED]
Ok. Thanks.
[SOLVED]
Post Reply