Bringing Web-based applications offline


Author: Joe 'Zonker' Brockmeier

The Web 2.0 mantra suggests that you forget desktop applications and embrace AJAXified browser-based apps that you can run from any OS, anywhere, as long as you have a speedy connection to the Internet. But what about times when you can’t get online? Firefox, Opera, and others are looking to make it possible run applications offline, anytime, anywhere.

Many frequent travelers, myself included, live in their webmail, Web-based calendars, and other online applications. It makes sense for “road warriors” to seek out applications that are only a Web browser away. However, that becomes something of an issue when you’re stuck in Denver International Airport thanks to a freak snowstorm.

Understanding offline support

Offline mode lets users browse documents that are stored locally without trying to fetch information from the Web. This is useful, but it’s not of much help when you’re trying to use an application like Google Docs, which assumes that you will be saving information to Google’s servers. Nowadays, developers are working to make Web-based applications usable when you’re not connected to the Web. This means that applications will be able to verify whether you are online, and if not, store information locally to be saved online later. They’ll let you work with information stored locally rather than trying to retrieve information from a remote server.

Microsoft has offered HTML Applications (HTA) for some time, which can be distributed as offline applications. However, HTAs are not cross-browser compatible.

Fortunately, standards are on the horizon. The Web Hypertext Application Technology Working Group (WHATWG) is working on standards for Web applications, including specs for persistent storage and offline Web applications.

Firefox 3.0 has offline support in its roadmap. Firefox developer Mark Finkle has been blogging about its offline capabilities, and Firefox developer Chris Double has been adding offline support to Zimbra, a Web-based open source messaging application, as a proof of concept for Firefox’s offline support.

Jan Standal, director of product management for Opera, says that Opera is also seeing interest in offline application support. Right now, Standal says Opera supports client-side storage of Web applications as Opera Widgets, but the company is also implementing storage for applications as specified by the WHATWG specification.

Standal says that Opera is seeing a lot of demand for offline apps, particularly for mobile devices. “Immediate access to the application data will be especially important for mobile phones and other types of devices where connection speed can be very limited and there is often no network available to the user at all. With Opera 9 we support Widgets on devices like PCs and mobile phones, and we see lots of request from the developer community for enhancing this with client-side storage capabilities.”

Offline support isn’t a new idea, but it is seeing a resurgence. Tom Snyder, founder and president of iNetOffice, a vendor of online document management software, says that Internet Explorer has had the ability to run HTML Applications for some time, but it wasn’t “as rich and full-featured as we hoped for.”

Firefox has also had modest offline features for some time, but only using normal disk cache to display pages — which isn’t sufficient for applications like Gmail or Zimbra. Finkle says the new features were “somewhat spurred by the offline features of the WHATWG” specification, and that patches and code for Firefox’s offline features started turning up last May.

According to Finkle, offline features are “a high priority” for Firefox 3.x, but “we are still in the process of developing requirements for the features. Some detail or problem could arise that causes the feature to be re-prioritized.”

If they build it, will you come?

While developers are itching for offline support, and road warriors may be eager to be able to use Gmail while stuck in the airport, what about the majority of users who don’t try to access online applications from anywhere but the comfort of their own home?

It’s possible that offline support will only be used by a small percentage of users, but Finkle says that it’s still worth pursuing. “One of the most frequently cited reasons for organizations not adopting Web applications is the lack of offline availability. Even if most users don’t need it, offline support removes a barrier to Web application adoption.”

Another challenge is cross-platform compatibility. Historically, Web developers have had to deal with incompatibilities between major browsers that mean either targeting a single browser or doing a lot of workarounds and spending additional development and testing time to ensure that applications work in every browser.

Finkle says that, where Firefox goes beyond the WHATWG standard to provide features not in WHATWG, Firefox developers “hope that other browsers will implement our APIs. We’ve tried to keep things as simple as possible to make that easy. Many of the necessary APIs are WHATWG standards already, and we will work with appropriate standards bodies on the rest.”

He also says that developers are creating libraries to make life easier for offline support. “We’ll likely see JavaScript libraries assisting Web developers with cross-browser offline mode issues. Projects like Dojo are developing components that enable offline applications in any browser, although their experience may not be as seamless without direct browser support.”

Standal says that Opera has “a strong commitment to follow the specifications,” such as WHATWG, and that Web developers should expect nothing less from other browser vendors. As for the possibility of supporting APIs from Firefox that address features that are not part of the WHATWG specification, Standal says that “HTML 5 is still a work in progress” and that Opera can’t commit to supporting anything beyond the standard, but that “we are likely to support a similar feature set, based on an updated specification.”

Challenges for offline apps

One of the biggest challenges from the Web application standpoint, according to Snyder, is “making it as simple and obvious to the user as possible.” Snyder says that, while the online/offline concept is intuitive to folks in the business of developing browsers or Web applications, “for someone running a flower shop … eyes are going to glaze over, they don’t want to understand it, don’t really care, they just want it to work.”

Snyder says it will be easier to make Web-based applications like spreadsheets or word processors work, because they “are more centralized” and deal with less data. Mail, on the other hand, requires a lot more data. In that case, the application will need to “predict accurately what users need offline. If they only have 30% of what they need available, it’s not really worth trying. If they have 95%, they might understand” that some data is unavailable and still be able to get work done.

Standal says data storage will be a challenge, and it will be up to Web application developers to handle it within their applications. The browser vendors can offer the features, but developers will have to modify their applications to suit the new functionality.

In the case of mail, Standal says that developers might choose to have their applications store only the unread or recent email, while the bulk of a user’s email will remain on the server. “We expect that most developers will use the client-side storage to cache only the data that is likely to be relevant and interesting for the end user.”

It could get a bit sticky if developers decide to try to store all of a user’s data for offline use when the user has a lot of data. Finkle says that Firefox will have cache quotas, and ways for developers to see how much room they can utilize on a user’s computer. “We also intend to have some APIs for Web applications to query for remaining cache space so they can make intelligent decisions about saving data. We are still working through these technical details.”


  • Web Development