March 8, 2021
Hot Topics:

Delivering HTML To a WML Device

  • By Steve Schafer
  • Send Email »
  • More Articles »

This series of articles describes how to provide Webcontent to mobile devices through WML (Wireless Markup Language). This articlecovers techniques to use when delivering standard HTML to WML-compatibledevices.

Note: These articles cover WML and WMLScript version 1.1,which are supported by the majority of mobile devices in use today. Thearticles assume a working knowledge of HTML and general Web technologies, andfurther assume that you have read the previous article(s) in this series.

Delivering Converted HTML

There may be several reasons why you may need to deliverstandard HTML markup text to a WML-compatible device. You may have data storedin a database that is typically displayed in a standard browser; legacy data orpages that resist conversion; or cross-platform text that needs to be primarilyavailable for a standard HTML browser, but would be useful if delivered to WMLclients.

For example, I'm the administrator for a movie news Website. The articles for the site are marked up using standard HTML, stored in aSQL database, and delivered to the clients using PHP pages. The bite-sizedarticles also make for great wireless contentsomething that can be browsedwhile in an airport or during other downtimeso I decided to make this contentavailable in WML. Unfortunately, I quickly found out how incompatible evenminor HTML tags are with WML, creating the need for some simple conversionprocedures. Although not perfect, those procedures are used as the basis forthis article.

Tip: The quick-and-dirty methods described in this articleare handy as a temporary or short-term measure. If you intend to support aparticular platform long-term, I recommend creating custom code for thatplatform.

Standard HTML vs. WML

Standard HTML documents don't work well on WML-capabledevices. Even if the wireless services offer translation services through theirgateways, standard HTML seldom displays as the developer or user would like.

Limited Tags

WML supports a very limited subset of HTML tags. Among thosesupported are the following tags:

  • Character formatting
    • <B> - Bold
    • <I> - Italic
    • <U> - Underline
    • <BIG> - Big text
    • <SMALL> - Small text
    • <STRONG> - Strong (visually emphasized) text
    • <P> - Paragraph
  • Table tags
    • <TABLE>
    • <TR> - Table row
    • <TD> - Table column/cell

Several tags nearly alike between the two languages, buttheir formatting and/or parameters are different enough to cause problems. Forexample, the line break tag is simply <br> in HTML, but <br /> inWML. Also, tags such as the table tags support many more options and parametersin HTML than in WML, and rarely allow HTML tables to display properly in WML.

Device Display Limitations

Standard HTML documents are generally designed for largedisplays, such as 800 x 600 resolution CRTs connected to a PC, not a 240 x 320LCD on a PDA (or smaller, if a cell phone). Even devices that runHTML-compliant browsers (such as IE in Windows CE devices) have problems withthe majority of today's Web sites.

The almost unrecognizable internet.com home page, displayedin IE on a Pocket PC (Windows CE).

Tip: To gauge roughly how a page will look on a smallerdevice, shrink your standard PC browser window down to that size.

Most mobile devices don't support the vast array of textformatting available toPC browsers. For example, earlier versions of certainmobile browsers don't support underlining; others don't support italic or boldtext. Tables are especially problematic due to their width.

Device memory is also a problem. Most mobile browsers onlysupport pages (decks) a few kilobytes in size, requiring the content to bebroken down into bite-sized chunks and displayed across several cards, if notseveral decks.

Finally, most modern PC-based browsers (IE, Mozilla,Netscape, and so on) have built-in logic to handle incomplete or misused tags.For example, most PC browsers are forgiving of HTML documents that fail toclose a major element such as a table or the body of the document. Most mobilebrowsers are far less forgiving, requiring very strict use of tags.

Device Input Limitations

Interactive Web pages present even more challenges to themobile user. Anyone who has needed to tap/write out even a short note on a PDAcan appreciate the need to keep interfaces simple. Those who have tried tocompose more than just a few characters on a standard cell phone keypad canappreciate this even more strongly.

The simplest Web interface is the form, whose structure isconsiderably different in WML. Simply converting the structure and tags isn'tsufficient; you also have to consider how it will affect the end user on his orher individual platform. For example, choosing the correct state code from adrop-down list is easy on a standard browser. However, drop-down liststranslate to select lists in WML, necessitating a list of 50 entries that theuser must scrolled through (usually 9 items per page) to select the propercode.

Page 1 of 2

This article was originally published on September 18, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date