faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

29 of 45 people (64%) answered Yes
Recently 5 of 10 people (50%) answered Yes


How to do Browser, JavaScript, and CSS detection using PHP?

Feb 29th, 2008 10:12
dman, Philip Olson, John S., Ben Udall, http://www.ttnr.org

The simplest way to find a users information is by viewing their 
HTTP_USER_AGENT and to do this simply print it :
    print $HTTP_USER_AGENT;
For a list of "predefined variables" such as the above, go here :
PHP has a built in browser detection function called get_browser, you 
can read about it here :
In the user comments comments you'll see links to user created 
functions/scripts that do such detections.  For an interesting article 
on this subject, have a look at :
And again, pay attention to the user comments.  This article explains 
how to use browser detection to create a browser friendly CSS.  
The "main" CSS guide out there is :
And you can find more CSS browser specific Information here :
Now regarding browser specific needs, such as with JavaScript, you'll 
want to know there Browser Object Models.  Good place to start :
  Both     : http://www.webreference.com/js/column6/
  Netscape : http://devedge.netscape.com/tech/dom/ 
  IE       : http://msdn.microsoft.com/workshop/cframe.htm?/
BTW, the IE link is on two lines, it doesn't fit on one here.