Solved

How to get browser information before loading a website?

Posted on 2013-06-20
5
302 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 20

Expert Comment

by:Patrick Bogers
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 20

Assisted Solution

by:Patrick Bogers
Patrick Bogers 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
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 video teaches users how to migrate an existing Wordpress website to a new domain.

809 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