How to get browser information before loading a website?

Hi

I need to get the following before loading a website:

1. Browser type (Mobile or PC)
2. Screen resolution
3. OS

Based on the info, redirect to a specific version of my site or load diferent CSS.

Thanks in advance.
dimensionavAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Scott Fell, EE MVEConnect With a Mentor DeveloperCommented:
This is a good library http://detectmobilebrowsers.com
0
 
Patrick BogersDatacenter platform engineer LindowsCommented:
Hi,

Clear question but not complete, in what language do you need this detection? php? asp .net?
0
 
dimensionavAuthor Commented:
PHP, please.
0
 
rgranlundCommented:
<?php
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))
 {
  <link rel="stylesheet" type="text/css" media="all" href=" " />
}
?>

Open in new window

So that is if it is an iPhone or IF it is a iPad use this CSS
0
 
Patrick BogersConnect With a Mentor Datacenter platform engineer LindowsCommented:
Hi

My advise is to start with get_browser()

For screen resolution i would recommend Javascript not php like:

var screenWidth = window.screen.width,
    screenHeight = window.screen.height;
0
All Courses

From novice to tech pro — start learning today.