I’ve long used a simple PHP script that tells me if a visitor is using Windows, Apple or Linux…
switch(PHP_OS)
{
case 'Linux':
break;
case 'Darwin':
require_once("Whatever.php");
break;
default:
require_once("Whatever.php");
break;
}
After starting to learn about designing for mobile devices, I discovered mobile queries, which let you target computers (screen) or mobile devices (handheld) with CSS styles.
Now I’d like to know if there’s a PHP script similar to the one above that detects users’ devices, distinguishing between computers, tablets and handhelds.
Until I get the hang of mobile design, I want to continue using my existing files for computer users, so I need a script that will let me include separate files for computers (screen) and handhelds.
What’s wrong with media queries as that was what they were designed for?
You can target screen width (or device width if you must) and serve the appropriate css. No need for scripts as such unless you are building a mobile only site and have lots of money and time to waste.
RWD (responsive web design) and responsible design is the way forward