June 11, 2011, 7:04 p.m.
posted by sl
Browse WML from Your Desktop
Once you've decided to take the plunge and create a handheld-only version of your site in the Wireless Markup Language (WML) format, you will quickly realize you've taken for granted the comforts of web development on your desktop computer. First of all, you can't view the source of a page on the BlackBerry Browser. View source is a very useful feature of modern desktop browsers that, as of yet, cannot be done on a BlackBerry. Equally as bad is when you are testing a change you made on your site and then refresh the page on your handheld to see the results—it takes ages to retrieve the document across the cellular data network compared to the same routine on your desktop. I won't even go into the convenience that the Web Developer Firefox extension brings to web development junkies.
You could use the BlackBerry Simulator [Hack #93] to view your site, but you still don't have access to viewing the source without coding your own program to do it. When I first dabbled in WML development, I wrote a Perl script that emulated an HTTP request from the BlackBerry Browser to view the source of a WML page—I sure wish I had access to the information in this hack back then!
The Opera web browser has a handler for WML that is turned on by default! This makes Opera a logical choice for developing WML sites. You can download Opera from http://www.opera.com. There are versions of the Opera web browser for Windows, Linux, Mac—almost any operating system you'd probably be using. The installation is quick and simple. Opera is free; however, ads appear in the toolbar. You can spend a few dollars to support Opera and get rid of the ads in your browser.
Once installed, you can visit any WML site and view it right in your browser. Figure shows Opera 8.0 viewing a test WML page.
You can view the source of a WML page you are viewing by choosing Source from the View menu. Opera also gives you a quick way to access what it calls Small Screen Mode. This feature allows you to view an HTML site in a very small window, about the size of what you would see on a BlackBerry. This mode can be accessed either by choosing Small Screen Mode from the View menu or by typing the keyboard shortcut, Shift-F11.
Viewing a sample WML page in Opera
Opera treats local files that have .wml extensions as WML files—most browsers require the WML MIME type be returned in the HTTP response header to treat documents as WML. This is quite convenient if you are used to the "develop locally" approach that many web developers are accustomed to.
Use the Firefox wmlbrowser Extension
The ever-popular Firefox browser doesn't support WML content by default, but there is an extension that affords some of the functionality that Opera provides. The wmlbrowser extension for Firefox can be found at http://wmlbrowser.mozdev.org/ and is installed just like any other Firefox extension. Detailed installation instructions can be found at this URL: http://wmlbrowser.mozdev.org/installation/wmlbrowser.html.
The wmlbrowser extension just adds a handler for the text/vnd.wap.wml MIME type that is returned in the HTTP response header on WAP sites. This allows you to view WML content from within Firefox. Figure shows a view of the same WML page as before using the wmlbrowser extension. Notice the different appearance of the page compared to the rendering by Opera. The wmlbrowser extension shows all the cards in your deck while Opera shows one card at a time, which is similar to the behavior of most "real" WAP browsers.
Just as in Opera, the wmlbrowser extension allows you to view the source of a WML page just as you would for a page that's formatted in HTML. Unfortunately, there is no syntax highlighting for WML like there is for HTML source in Firefox.
Viewing a WML page using the wmlbrowser extension
Because the wmlbrowser simply adds some code to handle the WML MIME type, you also cannot view local files and have them rendered as WML. The flexibility Opera provides makes it a better option for WML development at this time. Neither wmlbrowser nor Opera can interpret WMLScript at the time of this writing.