ag3nt42 Posted July 10, 2008 Share Posted July 10, 2008 I was just wondering if anyone knew of a way to check the clients browser to see if JS is enabled or not? thanks, ag3nt42 Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 10, 2008 Share Posted July 10, 2008 Include a no script tag that has a hidden 1x1 img that is actually a PHP script. In the head section of your template, but only add this part if $_SESSION['JavaScript'] is not yet set. <noscript> <img style="display: none;" src="/noscript.php" alt="Detecting JavaScript" /> </noscript> noscript.php <?php session_start(); $_SESSION['JavaScript'] = false; fpassthru( '/path/to/1x1.gif' ); ?> Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted July 10, 2008 Author Share Posted July 10, 2008 what is setting the session variable Javascript tho? i'm alil confused on how this works exactly.. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 10, 2008 Share Posted July 10, 2008 <noscript> is an HTML tag where the content is only rendered in a browser when JavaScript is turned off. The <noscript> tag I gave you has a single item in it, an invisible image. It just so happens that the src-attribute of the image points at a PHP script you create on the server. Hence this script is called by the client ONLY if JavaScript is disabled. In the noscript.php on your server, you set a session variable indicating that JavaScript is off. Then you fpassthru the contents of a 1x1 gif image (because it's supposed to be an image). Quote Link to comment Share on other sites More sharing options...
j007ha Posted July 15, 2008 Share Posted July 15, 2008 Ermm...i think u can check this by select Tools and inside the content u can c whether ur JS is enabled or not. Hope this can help Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 15, 2008 Share Posted July 15, 2008 Ermm...i think u can check this by select Tools and inside the content u can c whether ur JS is enabled or not. Hope this can help The OP wasn't asking how to check if JS was enabled or not in his browser but in the client's browser. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.