KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Trying to detect a user's browser with PHP only, is $_SERVER['HTTP_USER_AGENT'] a reliable way? Should I instead opt for the get_browser function? which one do you find brings more precise results? If this method is pragmatic, is it ill advised to use it for outputting pertinent CSS links, for example: if(stripos($_SERVER['HTTP_USER_AGENT'],"mozilla")!==false) echo '<link type="text/css" href="mozilla.css" />'; I noticed this question , however I wanted to clarify whether this is good for CSS-oriented detection. UPDATE: something really suspicious: I tried echo $_SERVER['HTTP_USER_AGENT']; on IE 7 and this is what it output: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618) Safari gave something weird with "mozilla" in it too. What gives?
Tags (comma-separated)
Save Edits
Cancel