Jump to content

Checking In Php If Javascript Is Available


Kon-Tiki

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...