For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > September 2006 > Re: How do I check if javascript is enabled in PHP?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How do I check if javascript is enabled in PHP?
ZeldorBlat

2006-09-28, 6:57 pm


Benjamin wrote:[color=darkred]
> you use a function called get_browser()
> it takes no parameters and anaylzes the HTTP_USER_AGENT
> it return an assoctive array
> you check "javascript" key and if it is set to 1 then javascript is
> enabled
> For example:
> $results = get_browser();
> if ($results["javascript"] == 1) {
> echo "You have javascript";
> }
>
> One thing you need to now is you must set the browscap.ini in your
> php.ini file to the location of you browscap.ini. You can get one at
> http://browsers.garykeith.com/downloads.asp
>
> Happy detection
> Jim wrote:

Of course that will only tell you if the browser /supports/ JavaScript
-- not whether it is actually enabled or not.

Your best bet is probably to use JavaScript to do something like set a
form variable then check if that variable got set when you process the
form.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com