Building a ChildBrowser Extension for WebWorks-Based PlayBook Apps

We have open sourced a WebWorks extension for the BlackBerry Tablet OS that enables external web pages to be displayed within WebWorks applications.

Motivation

In certain cases, launching the external browser to view web pages can be disruptive to the overall user experience of your app (the PlayBook’s excellent multitasking support notwithstanding).

In theory, it is possible to embed external web pages within a WebWorks app using iframes. However, in practice, the suitability of iframes in this context has diminished significantly due to the numerous counter-measures (framebusting, x-frame-options, etc.) that have been put in place to combat the security exploits targeting iframes. As a general-purpose mechanism for embedding arbitrary external web content, iframes are not a viable option.

An alternative mechanism for embedding external web pages is to spawn an isolated, independent browser instance within the WebWorks app (specifically for the purpose of displaying this content). Although WebWorks does not provide this functionality out-of-the-box, it can be made available to your WebWorks apps as a third-party extension.

Technical Details

The WebWorks framework houses applications within a WebKit-based browser instance. WebWorks also exposes a set of JavaScript APIs to this browser instance; these APIs enable app developers to interface with native device functionality. The bridge that makes this JavaScript API available, and the implementation of the native device APIs themselves, are written using Adobe AIR.

Using an undocumented (and officially unsupported) mechanism[ref]One possible explanation for this stance is that WebWorks may transition off of AIR at some point in the future.[/ref], application developers can write their own extensions in Adobe AIR that expose other low-level capabilities that are outside of the surface area of the core WebWorks API.

In this case, our goal was to build an extension that enables hosting a secondary WebKit instance within the context of a single WebWorks app. (This extension enables any WebWorks app to spawn a secondary WebKit instance that is completely isolated from the main instance.)

Armed with the WebWorks source code[ref]The WebWorks framework itself is open source.[/ref], particularly WebkitControl.as, and the QNXStageWebView documentation, we got to work.

Source Code

We have open sourced this work to help other developers improve the experiences of their WebWorks apps. To that end, the source code for our ChildBrowser extension is available on GitHub under the very liberal MIT license.

Grab the source code here, integrate the extension into your app (instructions are in the linked README) and send improvements our way!

  • http://www.willw.net/ Will Robertson

    Thanks for sharing this extension, it may come in handy for a WebWorks app I am working on.
    Does this mean some PlayBook apps are coming soon for PlayBook? That would be great news.

  • Anonymous

    Thanks for sharing this!

  • http://www.berryreview.com/2011/09/01/devs-polar-mobile-open-sources-playbook-webworks-childbrowser-extension/ Devs: Polar Mobile Open Sources PlayBook WebWorks ChildBrowser Extension – BerryReview

    [...] this functionality natively and alternatives like iFrames run into issues.Check out the details in Michael Russo’s post about the ChildBrowser extension or find the extension on GitHub. Kudos to Polar Mobile for sharing! Please Share With A [...]