Kon-Tiki Posted July 23, 2009 Share Posted July 23, 2009 I'm working on the non-Javascript compatibility of my site, and am stumped on one part.Right now, I need to choose one out of two functions to call, depending on whether or not Javascript is enabled. The problem is... I can't find a way to know that in PHP.I know of the noscript-tags, but a simple test like this doesn't work: <?php$javascript = true;?><noscript><?php $javascript = false; ?></noscript> Here, $javascript will always return false, so this isn't an option.Another way's by setting a hidden field in a form, altering it with Javascript, then checking its value in PHP. Problem with that is that I need to know without resending the page, so this isn't an option either.Third possibility that I found, was the get_browser() function. Only thing with that, is that it shows whether or not Javascript is possible on that browser, not if it's curently enabled or not.So... I'm stumped. Does anybody know how to do this? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 23, 2009 Share Posted July 23, 2009 You can't detect if a browser has Javascript enabled through PHP, you need to use Javascript to test that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.