Walrus
Walrus

Reputation: 20444

PHP Server User Agent to determine browser and CSS support

Is it possible from $_SERVER['HTTP_USER_AGENT'] to determine the browser name and it CSS support.

Upvotes: 1

Views: 993

Answers (1)

dsw88
dsw88

Reputation: 4592

Yes, but I wouldn't recommend doing it yourself. That user agent string is notoriously fickle. Some browsers send it one way, other versions of the same browser send it another. It's a mess to try to keep track of yourself.

I would recommend going with a library that can do this for you. Here's one from the CodeIgniter framework I use: http://ellislab.com/codeigniter/user-guide/libraries/user_agent.html

There are probably many, many others. This is a pretty commonly-done thing, so there's lots of solutions for it already.

Upvotes: 3

Related Questions