Chapter 12. JavaScript Mobile

Designing for the Web is about more than content and presentation—users expect websites to be interactive, responding to their choices. Fortunately, although it has some limitations, the JavaScript we use in developing for the mobile web is similar to that used in desktop web development.

We have already talked a bit about the WAP 1.1 standard scripting language, WMLScript. Don’t worry, we won’t go any deeper into this obsolete language.

Thankfully, a couple of years after this standard was released, mobile browsers started to add some support for JavaScript (or ECMAScript, to be totally correct). The standards for mobile scripting are more difficult to define than the standards for CSS. The great benefit is that, excepting some bugs, JavaScript can check at runtime whether some feature, object, or API is available, so we can code for different “standards.”

Note

The standard name for JavaScript is ECMAScript because it is defined by the ECMA (an international, private, nonprofit standards organization). There are three well-known dialects on the market: JavaScript (trademark of Oracle, licensed now to the Mozilla Foundation), ActionScript (trademark of Adobe), and JScript (trademark of Microsoft). At the base, they are the same language, and everyone adds new behavior. In practice, the name JavaScript is so common in the industry today that everyone—including Microsoft—uses it as the language name.

The only mobile-specific standard is called ECMAScript Mobile ...

Get Programming the Mobile Web, 2nd Edition 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.