The first Rich FAQ we are presenting is the long overdue Mobile Ajax FAQ and was created by Ajit Jaokar, Rocco Georgi and Bryan Rieger. We welcome comments and feedback.
Q: What is Mobile AJAX?
A. AJAX is a browser technology that involves the use of existing Web standards and technologies (XML/XHTML, DOM, CSS, JavaScript, XHR - XMLHttpRequest) to create more responsive Web applications that reduce bandwidth usage by avoiding full page refreshes and providing a more "desktop application-like" user experience. The term AJAX was coined by Jesse James Garrett in his seminal document at Adaptive Path.
Applications created by AJAX are generally classed in the category of Rich Internet Applications (RIA).
Mobile AJAX is the extension of AJAX principles to the mobile environment, which includes other constrained devices such as gaming consoles or set-top boxes featuring Web browsers. While technologically the same thing, Mobile AJAX is looked at as a special case of AJAX, as it deals with problems specific to the mobile space including the areas of constrained devices and constrained Web browsers in general.
Q: Is there a Mobile AJAX checklist/minimum requirements?
A. The mere existence of JavaScript in the browser is not enough. There has to be a clear distinction between JavaScript and Ajax support. There are many examples where a Web browser might very well support JavaScript, but may still be incapable of using AJAX techniques.
At a minimum, the requirements for Mobile AJAX include:
Q: Why should one do AJAX on mobile phones / what problem does it solve?
A. The reasons to use AJAX are the same as those to use it on the desktop:
The following is a list of current alternatives to Mobile AJAX:
Java ME (J2ME)
Currently the most ubiquitous runtime available for mobile devices by far, but also the most fragmented in terms of feature and specification support between vendors and devices. Things are improving as many OEM vendors are investing heavily into making the Java "write-once-run-anywhere" dream on devices a possible future reality. The recent decision by Sun to open source Java may result in more capable and compatible versions down the road, and initiatives such as OpenLaszlo + Sun's 'Project Orbit', or JavaFx may enable developers more familiar with Web technologies (rather than mobile Java development) to deploy directly to Java-enabled devices in the future.
Flash Lite
Flash Lite is Adobe's ubiquitous runtime for the SWF format specifically designed for use on resource-constrained devices. While Flash may be installed on nearly all desktop and laptop computers today, it is currently only available on a small number of mobile devices, namely higher-end smartphones and PDAs.
Early releases of Flash Lite supported a very limited version of ActionScript, which proved frustrating to many developers. More recent releases are closely following the versions of Flash and ActionScript that are found in widespread use today on the Internet, this in turn is expected to increase developer interest in the use of the Flash Platform on devices.
Q: How do Flash Lite and Java compare with Mobile AJAX?
A. Java often requires code variations for different devices and vendors, not to mention variations in the Java implementation itself (MIDP 1, 2, CLDC). These variations often allow Java applications to better take advantage of device hardware such as cameras, Bluetooth, and 3D graphics, but they fragment the implementation.
Flash doesn't typically require variations in code like Java, but may require variations in visual layout to provide an optimal user experience on varying devices. Newer versions of Flash Lite are working to minimize the additional visual layout work often required for varied screen sizes.
Mobile AJAX applications should work with the same code across varying devices and, through the use of cascading style sheets (CSS), the visual layout should adapt as required on a wide variety of devices. However, see limitations/hurdles of Mobile AJAX below.
Some browsers (Nokia S60) are expected to have plug-in support for Flash Lite in future releases. If such scenarios occur, Flash Lite could be used to complement Mobile AJAX applications in much the same way Flash and AJAX are often used together on the desktop Web.
Q: What is the difference between AJAX platforms, frameworks, toolkits and libraries?
A.
AJAX platforms, such as the Opera Platform or NetFront's Embedded Ajax,
when installed on the device, make it easy to develop applications and
widgets using standard Web technologies, including Ajax.
There is, however, a big difference between platforms on the one hand and frameworks, toolkits, or libraries on the other. While the latter are usually loaded along with the Web application into the browser each time, i.e., in the form of an external JavaScript file, platforms are typically installed once on the device and then loaded as required by the applications run on top of it. For example, Opera Platform widgets require the Opera Platform while Nokia Widgets require the S60 platform.
Q: What existing Mobile AJAX frameworks, toolkits, and libraries should I use?
A. Currently there are no specific Mobile AJAX frameworks, toolkits, or libraries.
qAll that is required for AJAX on mobile devices is support for:
Q: Can I use existing frameworks, libraries, and toolkits?
A.
Some existing frameworks, libraries, and toolkits may indeed work on
some mobile browsers. Generally however, these libraries require too
much memory and implement features that may simply never be used on a
mobile device (i.e., drag + drop). With increasing mobile browser
capabilities, this will become less of an issue as browser vendors are
already aiming to make their next-generation browsers work with these
toolkits; however, the overhead is still there. It can be assumed that
some of these frameworks will release mobile versions, so it's more a
question of when will we begin to see mobile-specific browser support
within these libraries and toolkits.
Q: What is the relationship between Mobile AJAX and Mobile Widgets?
A.
In its entirety, AJAX is comprised of XMLHttpRequest + DOM Scripting +
XHTML/CSS. Functionally, two things are happening here: data is being
fetched asynchronously and the information thus fetched is being
rendered on the client through JavaScript.
Most widget engines are using the asynchronous part uniformly but are making their own changes to the rendering (display) part. While this leads to fragmentation of widget technology, the fact still remains that AJAX, i.e., Asynchronous I/O and visual rendering, are the core technologies underpinning widgets.
When it comes to the mobile environment, we are seeing the same phenomenon, i.e., we see Mobile Widgets powered by Mobile AJAX and also some fragmentation. Also, it should be noted that we are seeing the first attempts at standardization of widgets from the HYPERLINK "http://www.w3.org/TR/widgets-reqs/" W3C.
Q: Which browsers support Mobile AJAX?
A. This is
the list of currently known mobile browsers supporting AJAX, which
means they feature the XMLHttpRequest or an equivalent ActiveX (as in
the case for IE Mobile). Some of these browsers currently exist and are
widely used; others are in development and are not yet available.
There are also other devices than phones that feature Web browsers to look at, for example, gaming consoles, such as the Nintendo DS and Wii or Sony's PSP or PlayStation 3. These devices - partly mobile, partly fixed - feature Web browsers (Opera for Nintendo, NetFront for Sony) that are comparable to those found on mobile devices such as cell phones. Some of these constrained browsers support AJAX (for instance, Opera browsers in Tranzas set top boxes). Another significant similarity is that these devices also feature very constrained input methods, sometimes less than on cell phones, e.g., four buttons and a four-way directional pad on the PSP.
Q: Which enterprise applications employ Mobile AJAX?
A.
SoonR is one of the early pioneers of Mobile AJAX and seems to always
be the preferred example. The SoonR application is primarily concerned
with access to files on the desktop from a mobile device. It mainly
supports Opera Mobile and S60 3rd edition for AJAX functionality, but
there also is a basic version for other browsers without AJAX.
Enterprise applications offer an opportunity for Mobile AJAX because
they provide a rich browser-based experience on a mobile device and, at
the same time, are not constrained by the need to access device APIs
(for instance pPhone book APIs on a phone).
Q: What is the role of the Apple iPhone with respect to Mobile AJAX?
A.
While this is speculative since enough details of the iPhone are not
known, Apple has said that the iPhone will not include Java and may
include Flash. It is very likely that the Web browser of the iPhone
will support AJAX. If that happens, then widgets could play a major
role on the iPhone with Mobile AJAX as one of their enabling
technologies. If so, it would help the uptake of Mobile AJAX post
launch of the iPhone.
How do applications like mojax or bling software fit in?
Mojax and Bling Software are examples of applications that use Mobile AJAX with Java as middleware. AJAX makes a great presentation layer, but isn't ideally suited for working with device-level APIs (Bluetooth, camera, XML, etc.) where technologies such as J2ME/BREW/C++ are already being used extensively. Thus, it is possible to use the combined strengths of each technology (J2ME + AJAX) to create the best experience possible.
While not leveraging open standards exclusively, these applications can very well make sense and they show that AJAX technology is a major building block in application development - either based on the Web browser or on a Java/C++ application.
In fact, Sun is taking a similar approach with its Java FX technology.
Q: How can you develop for and test on all those browsers?
A.
Much in the same way you develop for the Web today: use Web standards,
then find a good reference browser (Opera Mobile, Nokia s60, Internet
Explorer Mobile, etc.) and use it constantly throughout development. To
maximize compatibility, plan to build a normal mobile Website (without
AJAX) and progressively enhance it with AJAX as required. Test the site
or application on basic phones (WAP 2.0, XHTML-MP - no DOM/XHR) to be
sure it works for existing non- AJAX capable browsers.
Q: What are the (current) hurdles in implementing and running Mobile AJAX applications?
A.
The biggest obstacle is the same as on the desktop: browser support.
With more browsers than on the desktop and bigger differences in their
support for Web standards and technologies required by AJAX, this poses
a real problem and has kept many developers from going any further than
initial tests.
Another technical problem is HTTP latency. Loading only parts of the
Website in a mobile Web application can take as long as loading the
whole page (still traffic and rendering time in the browser will be
smaller). This varies from one connection type to the other and can
also be influenced by the carrier's implementation of their proxy.
Also power consumption and battery drainage of AJAX applications can be an issue. If an AJAX application constantly connects to a Web resource, e.g., to check for new data, this will not only drain the phone's battery heavily, but may also incur expensive data fees for some users. So AJAX functionality has to be applied in a responsible and meaningful way, especially in applications running on mobile devices.
Mobile AJAX and Mobile Widgets, while showing a lot of promise, are still currently geared toward simple tasks and applications.
Q: What are AHAH / AJAH?
A. The desktop computer
has much more memory and CPU power as well as different means to input
data into the application. Mobile AJAX has to work on resource
constrained devices and browsers, so typically most desktop AJAX
libraries cannot be used on mobile browsers. Instead of sending and
manipulating raw XML on constrained devices, it makes a lot of sense to
leave the manipulation of XML to the server and send only XHTML to the
client.
This technique, while very similar to AJAX is often called AHAH - Asynchronous HTML, and HTTP - or AJAH - (HTML instead of XML). Fundamentally both methods do not transport XML, but pre-rendered HTML or XHTML, and avoid having to process XML data on the client, which can be a very battery- and CPU-intensive operation.
Q: Is there any standardization initiative for AJAX?
A.
While not a standards body, the OpenAjax Alliance is bringing different
players in the industry together (and this also includes Mobile AJAX).
Feedback Requests and Enhancements
We
welcome feedback and enhancements requests. If your company is doing
some interesting work in this space, we can consider adding it to this
FAQ. Please contact ajit.jaokar at futuretext.com for any suggestions.
Acknowledgments
We would like to
acknowledge the work of the following people/groups: Eli Dickinson,
editor, FierceDeveloper, C Enrique Ortiz, Daniel K. Appelquist, and The
OpenAjax Alliance