Simple clear advice in plain English

Designing websites for mobile users

Decisions made when designing a website can cause a lot of work later on

Judging by the emails I receive, quite a few readers are clearly interested in mobile websites.

We’ve talked about how to optimise sites in various ways, along with some of the dos and don’ts.

One aspect of mobile site optimisation is whether or not you should do it at all ­ – a topic that’s discussed in ‘To mobi or not to mobi?’ below.

Arguments can be made either way, but below I’ll be looking at how to handle the practical aspects of updating your site.

Where we are
The particular set of pages that I’m considering updating allow visitors to my site to remotely program their digital TV recorder, either to search the EPG (electronic programme guide) for a specific programme or to set a recording for a specific date, time and duration. It’s the only section of the site that’s designed for mobile use, because it’s the section most likely to be used when you’re mobile.

The site’s coded in PHP and all the pages in the section rely on a function that’s in a library file called moblib.php, which is where I’ve put things relating to mobile access.

But iPhone users need something a bit more sophisticated; the text links might not be so easy to see and, further down the screen, larger options on the form will be useful as well.

How do we get this far? Well, this is part of what’s in our mobile library:

function isMobile() {
returnpreg_match(‘/Symbian|MIDP|Nokia|SonyEriccson|UP.Browser|Smartphone|iPod/’,$_SERVER[‘HTTP_USER_AGENT’]) ;
}
function brokenMobileBrowser() {
// some browsers don’t seem to populate hidden form fields
returnpreg_match(‘/SEMC-Browser/’,$_SERVER[‘HTTP_USER_AGENT’]) ;
}

In the pages within this section of the site there are a few simple tests. The isMobile function is used to choose which style sheet to load, and reversed to turn on the

tags that are needed for the main layout and to load the contents of the side navigation panels, like this:



< imgsrc=”../images/timerbar.jpg” alt=”Go back to home page” width=”700” height=”100” border=”0”>






Reader Comments

   

Add your comment

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

Hands on: Indices and mapping

How to control the way your site is indexed by search engines

Hands on: Organise your website's information

Make your site easy to navigate with any browser, and confound overseas spammers

Web development - Site under construction

Tim Anderson begins a new Hands On series with an introduction to dynamic web site development.

Question & Answer

Q.How do I stop Windows 7 search?

> Read the answer

Q.Is it a genuine call from Microsoft?

> Read the answer

Q.How can I turn Autoplay back on?

> Read the answer

Best deals on the web

img

Apple MacBook Pro (MC724LL/A)

£999.99- Buy it now

img

Samsung 300E5A-A01DX

£449.99- Buy it now

img

Sony Vaio VPCF23P1E/B

£679.98- Buy it now

Great benefits for subscribers!

Most popular articles

Poll

Which is your preferred web browser

Jargon Buster

Computing terms explained in plain English

Bios

Basic Input Output System. Essential software built into every PC that connects the vital components....