Detecting Browser Types?
Posted
by
Mike Schinkel
on Pro Webmasters
See other posts from Pro Webmasters
or by Mike Schinkel
Published on 2011-01-14T05:58:00Z
Indexed on
2011/01/14
5:58 UTC
Read the original article
Hit count: 323
My client has asked me to implement a browser detection system for the admin login with the following criteria, allow these:
- Internet Explorer 8 or newer
- Firefox 3.6 or newer
- Safari 5 or newer for Mac only
And everything else should be blocked. They want me to implement a page telling the user what browser they need to upgrade/switch to in order to access the CMS.
Basically I need to know the best way to detect these browsers with PHP, distinct from any other browsers, and I've read that browser sniffing per se is not a good idea.
The CMS is WordPress but this is not a WordPress question (FYI I am a moderator on the WordPress Answers site.) Once I figure out the right technique to detect the browser I'm fully capable to make WordPress react as my client wants, I just need to know what the best ways are with PHP (or worse case jQuery, but I much prefer to do on the server) to figure how what works and what doesn't.
Please understand that "Don't do it" is not an acceptable answer for this question. I know this client too well and when they ask me to implement something I need to do it (they are a really good client so I'm happy to do what they ask.)
Thanks in advance for your expertise.
-Mike
© Pro Webmasters or respective owner