I'm using the get_browser()
function in an attempt to warn people that their browser doesn't support Javascript. Actually I'm using it to tell them they can use certain parts of a web application I'm building. I've decided to properly use Javascript because I'm tired of listening to developers that are scared of using it and I've seen some great potential in the language. I digress, here is the error.
browscap ini directive not set
Now I'd imagine this means I need somthing set it the php.ini. Can someone give me some direction on this one?
You can check the browser by using Browser class download it from Github
Configuration
I don't think this is the "best" solution to detect is a browser supports what you need for your website :
User-Agent
For the second point, you should test if the browser actually supports what you need -- and not rely on a list such as the browscap one.
Still, to answer your question about
browscap
: there is a note at the bottom of the manual page forget_browser
that says (quoting) :So, you have to :
browscap
directive in yourphp.ini
file, so it points to the file you downloaded.There is a bug in PHP that can also result in this error when the real problem is that the web server can't read the browscap file (e.g., if it's owned by root instead of www-data). See https://bugs.php.net/bug.php?id=74501
I know this topic is old, but you can use something like:
to display if JavaScript is not enabled.