Overview of wireless markup languages

Introduction

The mobile web has increased rapidly in sophistication in the last 5 years or so. Originally, mobile devices were fairly basic and had a text-only black and white screen, with no graphics. However these have rapidly evolved into the sophisticated "smartphones" you see these days, such as the Nokia N95/96 and the iPhone.

For this reason, the method of developing web pages for mobile devices has also evolved. The earlier and more basic mobile devices use WML, Wireless Markup Language, an XML-based format specifically for mobile browsing. However the most recent devices can handle full XHTML and CSS, and even Web 2.0 technologies such as AJAX.

It is important to realise though that not everyone has access to a "smartphone", and some are still using the older, more basic devices. For this reason, if you wish to develop for the mobile web and make your site accessible to a wide range of phones, you need to know the older languages.

Evolution of markup languages

WML

One of the earliest approaches to phone browsing was WML. This is not used in high end phones these days but still used in more basic phones, so it is useful to know it.

(These are based on Jomo's notes)

What is WML?

WML 1.x Basics

WML example

<?xml version="1.0"?> 
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" 
"http://www.wapforum.org/DTD/wml13.dtd"> 
<wml> 
<card id="card1" title="My Name"> 
<p>Tim</p> 
<p>Smith</p> 
</card> 
<card id="card2" title="My course"> 
<p>Computer Networks</p> 
</card> 
</wml>

Other WML tags

Many WML tags are common between WML and HTML, e.g:

(ref: W3Schools WML tutorial)

WML is more like a programming language than HTML

XHTML phone browsers

Modern phones typically access the web via a standard web browser, similar to a regular desktop or laptop. There are a number of phone browsers available (ref: Wikipedia article) including:

So the familiar issues with cross browser compatibility come into play even more so in mobile development than in desktop web development. That said, many mobile browsers are based on the WebKit page rendering system so web pages in any of these browsers will be treated similarly.

Considerations when developing mobile web pages

Considerations must be made when developing mobile web pages that would not need to be made when developing desktop web applications (ref:W3C). In particular the following issues apply to the mobile web:

In view of this, the W3C make the following recommendations in their mobile best practice document:

Serving pages for regular browsers and mobile browsers

You might want to adapt an existing web page for use on the mobile web. If that is the case, you can generate both from a single server-side (e.g. PHP) script. The script would generate slightly different HTML depending on the nature of the web browser (desktop or mobile). For instance, you could arrange the page layout slightly differently for a regular browser and a mobile browser, or, leave out the images on the version for the mobile browser.

If this is the case, you can use the PHP built in variable $_SERVER['HTTP_USER_AGENT'] to determine the user agent (the client software) that requested the server side script. You then test the contents of this variable and act accordingly. We will expand upon this next week when we cover WURFL.