ideas & ramblings

Leveraging offline web technologies for more responsive online apps

(Originally published in 2011.)

Note: this is a position paper I’ve submitted for W3C’s The Future of Off-line Web Apps workshop in Redwood City next month.

As a developer working on a large, client-heavy application, I’ve spent a lot of personal time and effort attempting to optimize my static assets. Eventually, applications reach the limit of what is reasonably possible without re-architecting.

The application cache standard offers us an interesting ability. Although it’s intended use is to let applications work without access to current versions of assets, updating them optimistically when possible, we can use it instead to move the slow process of updating assets out of the critical path for online users of our sites. Even after a new version of an app has been deployed, for visitors who are returning to an app, the previous version that they used is most likely sufficient. We can use the application cache to update assets in the background, rather than prior to page load. Although users are at risk of using out-of-date assets for that session, they may experience vastly decreased load times, and in some cases, this is a reasonable trade-off.

Browsing inconsistencies aside, the standard as it exists today makes this possible, but it is lacking several facilities that would improve the experience for developers.

The stated goal of this workshop is to identify a clear path forward for innovation in the Open Web Platform related to offline Web application invocation and use. I have contributions to offer in two broad categories:

1. Issues and inconsistencies with current implementations. There are a number of inconsistencies between common implementations of the spec as it exists right now, many of which are simply due to grey areas in the spec. Additionally, I would like to rally support for the creation of a standard test suite to ensure standards compliance between implementations.

2. Extensions to facilitate development, particularly with respect to the caching of online applications Although it was designed to enable offline web applications, the appcache can be leveraged to dramatically improve load times of online applications as well, especially for users on high latency Internet connections. With some improvements to make this process easier, I believe the appcache could be used to significantly improve the speed of web applications.

Even if the “online cache” use case is not pursued, I believe that there are some improvements to the standard that will improve the offline use case, especially with respect to the JavaScript API.