Chapter 9. Ajax, RIA, and HTML 5

Wow! Ajax, HTML 5, and RIA? How do these things fit together on a mobile device? We all know that Ajax is just a JavaScript technique, so that part is obvious. For mobile browsers, HTML 5 is also more or less a JavaScript thing, with some bonus markup features (the new technologies borrowed by the mobile browsers from the HTML 5 draft are almost all new JavaScript APIs that will work with HTML). Rich Internet Application development also involves the implementation of some JavaScript UI pattern designs.

Ajax Support

Ajax is especially important for mobile devices. The ability to download only the data to be updated and avoid unnecessary page loads is key for mobile browsers. However, Ajax is not part of the official standards, and support can vary from device to device.

Note

If your mobile website gets content using Ajax, you should implement Google’s proposal for search engine optimization (SEO). You can find more information about this at http://code.google.com/web/ajaxcrawling.

Let’s first verify the browsers’ support for the XMLHttpRequest native object (see Table 9-1). Cross-domain requests are not compatible with mobile browsers today because of supposed security problems, but you can bypass this problem with a simple proxy on your server.

Table 9-1. XMLHttpRequest support compatibility table

Browser/platform

XMLHttpRequest support

Safari

Yes

Android browser

Yes

Symbian/S60

Yes since 3rd edition

Nokia Series 40

No before 6th edition

webOS

Yes

BlackBerry

No before ...

Get Programming the Mobile Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.