Solved

How to get browser information before loading a website?

Posted on 2013-06-20
5
300 Views
Last Modified: 2013-06-22
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.
0
Comment
Question by:dimensionav
5 Comments
 
LVL 19

Expert Comment

by:Patricksr1972
ID: 39263925
Hi,

Clear question but not complete, in what language do you need this detection? php? asp .net?
0
 

Author Comment

by:dimensionav
ID: 39263947
PHP, please.
0
 
LVL 7

Expert Comment

by:rgranlund
ID: 39264013
<?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
 
LVL 19

Assisted Solution

by:Patricksr1972
Patricksr1972 earned 250 total points
ID: 39264025
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
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 250 total points
ID: 39264301
This is a good library http://detectmobilebrowsers.com
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question