O'Reilly logo

jQuery Mobile: Develop and Design by Kris Hadlock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

17. Detecting Mobile Devices

Mobile websites are often developed separately from primary websites (those intended to be viewed on a desktop or laptop), although they may use much of the same content. To make sure your website is tailored for mobile devices, you’ll want to detect when a mobile device visits the site and then redirect the device to markup made especially for mobile. You may also want to deliver a website layout and content based on a specific mobile device. In this chapter, you’ll learn how to do both. Let’s begin by learning how to detect when a mobile device accesses your website.

Using PHP

Since PHP is one of the most popular scripting languages on the web, let’s look at a PHP function that performs mobile detection across a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required