Saturday, July 19, 2008

WML for mobile webpages


Phone manufacturers and wireless operators developed their own lightweight content markup languages to replace HTML. Examples of such markup languages include cHTML, which is used by i-mode services, and HDML, which is promoted by Phone.com. However, having to deal with multiple markup languages was a big burden for mobile content developers and it hindered the adoption of the mobile Internet in those early days. To solve this problem, a standard mobile content markup language supported by all mobile device manufacturers and operators was needed. The Wireless Markup Language (WML), defined by the WAP Forum, emerged as such a standard.

The WAP Forum is an industry-standard body that develops the data communications protocols for mobile networks. WML is officially part of the Application Environment specification of the WAP standard. Put simply, all WAP-compatible devices should support WML.

Unlike page-based HTML, a WML document is conceptualized into "a deck of cards." Each card represents one screen of content, and the internal links among the cards enable navigation from screen to screen. The ability to download multiple cards at once helps to reduce the slow and unreliable network round trips in WAP applications. The following code snippet demonstrates a simple WML document. The first card asks for your name and the second one echoes it back to you. The device needs to download the WML document only once to get both cards.

Download the WML sample here.

You've probably already given in to the temptation to put this document on a web site with the extension .wml and try it out with your phone. However, if your web server sends it with a Content-Type of text/plain, it might not load properly. To be sure your web server is sending it correctly, see "Configure the Server for MIME Types," later in this hack.

WML has made enormous progress in standardizing mobile browsers. However, as the mobile phone's capability improves, the need to keep the content markup language as light as possible has diminished. Instead, the challenge is to add more features to the WML standard and, at the same time, improve interoperability with the vast number of web sites in the wired Internet world.

No comments: