Cover by Maximiliano Firtman

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 10. Server-Side Browser Detection and Content Delivery

Until now, this book has only discussed the client side of mobile web development. Server-side development has an especially important part to play here, though, not only because of all we know about dynamic content generation, but because the server is the only place where we can easily make decisions about what content to send to which devices.

In this chapter we will look at device detection and content delivery, and introduce the creation of a content store. The server also manages the MIME types of content, a very important feature we need to define for good compatibility in the mobile world.

Note

We can use any server-side platform, server, and/or programming language. For the purposes of clarity our samples will use PHP, although this chapter will provide short tips for ASP.NET and Java as well. You can easily export these techniques to any other server platform.

Mobile Detection

Before talking about detection of mobile devices and services on the server, we need to go back a bit and consider an old friend: the HyperText Transfer Protocol, also known as HTTP. Knowing a bit about its internals will help us determine what we can do in terms of mobile web development.

Note

There are no special server requirements for mobile websites; you can just use the same Apache, Internet Information Server (IIS), or other server you are currently using for desktop websites.

HTTP

HTTP is a protocol originally defined in 1991 for document ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required