The following text is an extended version of an introductory article I recently wrote for the .net magazine and it is meant to further illustrate what can be found in my slides that I used during my presentations about Mobile AJAX at the XML conference 2006 in Boston and during the “Webmontag” in February in Munich.
The slides are available as a PDF document.
I am a web developer, so as a result my view on the topic is limited. Keeping it as pragmatic as possible and finding out what can be done right now are my main goals.
Mobile AJAX is a huge buzz word. Naturally there is a lot confusion going on about what it is and what it does. Opinions range from Mobile AJAX being a “significant mistake” to having enough “disruptive potential” to replace installable applications, i.e. J2ME apps.
The mobile web grows rapidly, data plans are becoming increasingly affordable, even flat rates for mobile data access appear on the horizon. Also browsers on mobile devices, such as cell phones or gaming consoles are becoming increasingly capable…It’s about time to spice up mobile web applications with a little AJAX!
Using AJAX brings numerous advantages for web applications, especially when looking at mobile devices: loading only parts of documents shrinks traffic and results in better response times and an application-like feeling.
Mobile devices have rather constrained capabilities in terms of CPU performance, memory, battery lifetime, screen size and bandwidth. Furthermore web browsers on mobile devices usually fail to provide the necessary technologies and standards such as JavaScript, CSS and DOM.
Still the situation in mobile browsers is not as bad as you might expect. There are numerous browsers that currently support AJAX: Opera Mobile (not mini), IE Mobile, Nokia S60 (3rd ed., WebCore) and Minimo (Mozilla). Also NetFront and the OpenWave browser should be mentioned. Their newest/upcoming versions also support AJAX.
The basic technology in Mobile AJAX is not different from desktop browsers. Basically the XMLHttpRequest object (XHR) or an equivalent ActiveX is used to handle asynchronous communications.
One way to go is to use the smallest common denominator of your target group (in terms of browser capabilities). Then implement your web application for that, write simple, clean, semantically correct markup and add additional bells and whistles in an unobtrusive manner with JavaScript.
Also remember that DOM manipulations cause heavy CPU and memory load. It might be a good idea not to access web services directly to handle the XML, but to route access through a server-side script that returns pre-generated HTML.
Another big issue is power consumption, because “looping” JavaScript can drain the power quite heavily. Therefore plan ahead and use XHR on demand!
While Mobile AJAX is well worth looking into, it should not be done just for the sake of it. Unfortunately the use of existing AJAX frameworks and toolkits, such as Prototype or dojo is practically impossible due to their focus on desktop browsers and a rather big functional overhead (drag-and-drop). A mobile AJAX framework (for mobile web browsers) would be a real helper, but does not exist yet.
Via: Pavingways - Rocco Georgi