Previous Page Next Page

Chapter 3. Working with JavaScript and HTML Within Adobe AIR

This chapter provides an overview of the HTML and JavaScript environments within Adobe AIR. It discusses:

Once you have completed this chapter, you should have a solid understanding of the HTML and JavaScript environments within Adobe AIR. You should also understand how to work with AIR and ActionScript APIs within HTML and JavaScript- based applications.

3.1. WebKit Within Adobe AIR

Adobe AIR leverages the open source WebKit-rendering engine to add support for rendering HTML content to the runtime.

In addition to HTML rendering, WebKit also provides support for associated web technologies, such as (but not limited to):

Essentially, Adobe AIR has a full HTML rendering engine, and includes support for all of the same technologies that can be used when developing web applications and content targeting the web browser. Developers can build full-featured AIR applications that leverage these technologies.

NOTE

You can find more information on the WebKit project at: http://www.webkit.org.

3.1.1. Why WebKit?

Adobe spent a considerable amount of time researching which HTML engine to use within Adobe AIR and used a number of criteria that ultimately led them to settle on WebKit.

3.1.1.1. Open project

Adobe knew from the very beginning that it did not want to create and maintain its own HTML rendering engine. Not only would this be an immense amount of work, but it would also make it difficult for developers, who would then have to become familiar with all of the quirks of yet another HTML engine.

WebKit provides Adobe AIR with a full-featured HTML engine that is under continuous development by a robust development community that includes individual developers as well as large companies such as Nokia and Apple. This allows Adobe to focus on bug fixes and features, and also means that Adobe can actively contribute back to WebKit, while also taking advantage of the contributions made by other members of the WebKit community.

3.1.1.2. Proven technology that web developers know

As discussed earlier, one of the biggest problems with complex web application development is ensuring that content works consistently across browsers. While something may work perfectly in Firefox on the Mac, it may completely fail in Internet Explorer on Windows. Because of this, testing and debugging browser-based content can be a nightmare for developers.

Adobe wanted to ensure that developers were already familiar with the HTML engine used within Adobe AIR so they did not have to learn all of the quirks and bugs of a new engine. Since Safari (which is built on top of WebKit) is the default browser for Mac OS X (and is also available on Windows), developers should be familiar with developing for WebKit.

3.1.1.3. Minimum effect on AIR runtime size

The size of Adobe AIR is approximately 11 MB on Windows and approximately 16 MB on MAC. The WebKit code base was well written and organized and has had a minimal impact on the final AIR runtime size.

3.1.1.4. Proven ability to run on mobile devices

While the first release of Adobe AIR runs only on personal computers, the long-term vision is to extend Adobe AIR from the desktop to cell phones and other devices. WebKit has a proven ability to run on such devices and has been ported to cell phones by both Nokia and Apple.

3.1.2. WebKit version used within Adobe AIR

The version of WebKit included in Adobe AIR 1.0 is based off the WebKit mainline version 523.15.

Some changes were applied to this version in order to support AIR's own rendering pipeline and enforce some security restrictions (please check the Section 3.3" and the "Security" subchapters to find more details about the differences).

The User Agent reported when running in Adobe AIR in Windows is:

Mozilla/5.0 (Windows; U; en) AppleWebKit/420+ (KHTML, like Gecko) AdobeAIR/1.0

and on Mac:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) AdobeAIR/1.0

Overall, developers should expect code running in Safari 3 to also work in Adobe AIR, with the exceptions of the differences discussed in this chapter.

Previous Page Next Page