RE: [PHP] JavaScript Enabled?
| From: | Rich Gray | Date: | Mon, 29 Mar 2004 13:51:18 +0000 |
| Subject: | RE: [PHP] JavaScript Enabled? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181657@lists.php.net to get a copy of this message | ||
> Can anyone suggest a suitable means for detecting if a client browser
> has JavaScript enabled or not?
>
> I know this isn't exactly PHP related, but I need to make sure my PHP
> script offers an alternative in a friendly way and not a JS error, but
> I just wondered if there was a foolproof method of doing this?
Er ... how do you generate a JS error with a JS disabled browser?
I don't think there is a 100% reliable way of detecting server side whether
a client browser has disabled javascript. However what you could do is to
use a <script></script> block to spit out javascript enabled code using
document.write() which will be ignored by disabled clients and then use
<noscript></noscript> tags to enclose whatever stuff is necessary for the
disabled clients?
Just a thought
Cheers
Rich