# Future Standards for (Off-Line) Web Applications

## Telefónica's Position Paper

Date:
  10/07/2011
Editor:
  José Manuel Cantera Fonseca <jmcf@tid.es>
Contributions from:
  Daniel Coloma <dcoloma@tid.es>

### Abstract

This paper is intended to present Telefónica's position on the Future of Off-line Web Applications.

## Introduction

HTML5 [HTML5] and the Open Web Platform are enabling a new wave of Web Applications. A Web application can not only work in multiple devices and/or platforms but it is also easier to develop and distribute. On the other hand it usually has a strong dependency on the availability of a network connection. As a result the user experience degrades while being off-line. On a mobile environment, where total or partial disconnections are usual (due to network coverage or triggered by user's preferences) this problem is even worse. Thus, there is a demand for technology that allows to interact with web applications regardless of connectivity restrictions. In addition off-line mechanisms could provide other benefits, for instance, less bandwidth consumption and better responsiveness.

This paper is intended to explain our position with respect to the issues that are coming out while developing, deploying and interacting with (hosted-installable) mobile web applications that can work off-line. In the next section the state of the art is analysed, including pros and cons of the existing solutions. Then, we continue by making our proposals, some of them based on the requirements elicited by our "Open Web Device" initiative, a new concept of feature phone based on HTML5 and the Web Platform. Finally, conclusions are presented.

## State of the Art

There are currently two different mechanisms proposed by W3C to support off-line scenarios: the Widget Packaging family of specifications [Widgets] and the Application Cache defined under HTML5 [AppCache]. None of them gives an answer to all of the problems. Widget Packaging has not been fully endorsed by the web community, whereas Application Cache has many flaws and shortcomings. Besides, the open source and browser vendor communities are starting to propose alternative mechanisms to describe and deploy (hosted-installable) Web Applications, particularly in the context of Web Application Stores. It is important to note that these mechanisms are not mutually exclusive, thus they can be combined in the same application.

### W3C Widgets

W3C Widgets is a set of specifications intended to standardize all the technical aspects related to simple web applications, known as widgets. Widgets are single-purpose (packaged-installable) web applications (weather, time, stock) that usually float on the user's desktop. W3C Widgets are packaged as .zip files and described by an XML Manifest (config.xml), which contains basic metadata (entry point, width, height, author, license). Widgets can be signed by its author and/or by distributors and follow the same install / uninstall paradigm as native applications. Once they are on the user's device only an "update signal" can replace the widget content. Such an "update signal" has to be explicitly raised by the developer (or by an application store client on his behalf). Widgets typically can make use of network resources (REST services, additional Javascript code, etc.). However developers have to provide all the application logic to ensure that the widget still works while being disconnected.

In our opinion the main strength of the Widget approach is that it enables a similar user experience (in terms of application lifecycle) than with native applications. However, the widget paradigm does not benefit from the distribution and update facilities offered by the traditional web (hosted) model. Nonetheless, We believe the widget manifest is a good starting point for the definition of a new manifest format for applications on the Web.

### HTML5 Application Cache

HTML5 introduces new methods for enabling a web site or web application to function without a network connection. The main mechanism introduced is an application cache that can store resources to be used by the browser when it is not online, granting users partial access to the application. The application cache is controlled by a manifest text file, which contains a list of resources to be stored for use when there is no network connectivity. The list can also define the conditions for caching, such as which pages should never be cached and even what to show the user when he follows a link to an uncached page. In addition the application can know (or be notified) through scripting whether there is a network connection alive or not (navigator.online / offline properties).

The main strength of the HTML5 application cache mechanism is its simplicity. It allows to support simple use cases without requiring a lot of effort from the developer. However, different caveats are limiting its adoption on real world scenarios:

- The Web Browser is not aware of the changes at the server side of cached resources. To trigger an update the manifest file itself has to be modified. This limitation makes the caching mechanism not transparent for the developer. Even worse if the manifest is cached then no update will be performed at all. As a result unpredictable behaviors are usual.
- The relationship between the application cache (persistent) and the browser regular cache (transient) is not clear.
- Browser implementations usually are not able to determine whether the application server is reachable or not. The only thing that is detected is whether the host machine is connected to a computer network. We believe the concept of being offline has to be revisited to tackle this issue.
- There is no integration between the manifest file and other application descriptors.
- Managing online resources while being offline is not convenient. For instance, It would be good to have a queue of pending form submissions.

### Emerging Web Browser Vendor Proposals

Web Browser vendors are promoting the development of installable-hosted web applications [ChromeApps]. They are built and deployed as a traditional web site with the only difference that additional metadata is added [MozApps]. Such metadata allows the User Agent to discover, install, launch, and grant them additional privileges. For implementing this concept new application description formats (based on JSON and similar to Widget's) are being defined. However if offline capabilities are needed the Application Cache manifest has to be used.

These new manifest format proposals are precursors to fragmentation on the Web and we believe action has to be taken to avoid it.

Figure 1 Open Web Device Overview

## Case of Study : Open Web Device

The "Open Web Device" (OWD) initiative is an internal innovation project being developed at Telefónica. We are defining a new concept of feature phone harnessing all the potential of the new Open Web Platform. The target is to provide a phone's user experience (home screen, dialer, camera, gallery, messaging, ...) totally based on Web Applications. Such Web Applications will be supported by a web browsing environment on top of the device's operating system, for instance a Linux's flavor. When the device boots up the web browser will load a home page that would allow a user to get access to the (installed or offered) applications.

An initial version of the OWD concept has been implemented using the W3C Widget technology and the Device APIs proposed by the Wholesale Applications Community (WAC) [WAC]. One interesting concept developed by the OWD is that related applications can communicate and be packaged as suites. For instance, the messaging and contacts applications can conform a suite, because they are usually strongly related. Widget specifications do not support these concepts, thus we have needed to extend them.

Another concept we are exploring is dynamic user experience personalization driven by the mobile operator. That is something that can be easily done with Web Technologies, for instance, by changing remotely a style sheet to implement a new theme. The current architecture based on Widgets makes it not so easy to implement because a full application reinstallation would be needed. Another option would have been to use HTML5 application cache combined with widgets. However due to the unpredictability of application cache we have decided not to implement it for the time being.

We believe that our OWD initiative would benefit from a future convergence between the Widget and Application Cache mechanisms, leading to a new standard more robust and versatile. This point is further explained on the next section.

## Our Proposal

We believe that in the future web applications will be remotely hosted, but at the same time providing a similar user experience as if they were physically installed on the user's device. In order to meet this goal further design and standardization actions are needed. Thus, We propose to define a brand new standard to support the new wave of Web Applications. It would result from the convergence between Widgets, HTML5 Application Cache and emerging browser vendor proposals. At this respect we believe the following requirements have to be met:

- A unique and harmonized information model (and semantics) for describing Web Applications. It should define metadata concerning the different aspects of a web application (security, privacy, multi-screen support, off-line capabilities, ...).
- One or more syntaxes (JSON, XML, ...) to convey the information model.
- Standard APIs for getting access to descriptors, to manage application lifecycle, discovery, etc.
- Predictable and well-defined on-line / off-line behaviors, including a clear separation of browser and server responsibilities.
- New mechanisms to help developers to deal with online resources while being off-line, for instance automatic form data storage in a queue or data synchronization facilities.

## Conclusions

In our opinion existing approaches for supporting off-line web applications are incomplete and immature. We are far from the dream of hosted web applications that provide a seamless user experience. In addition there is a high fragmentation risk in the market. Telefónica believes that new standardization actions are needed to face with these challenges. Particularly, the definition of new specifications resulting from the convergence between Widgets, HTML5 Application Cache and other emerging innovations proposed by web browser vendors or open source communities.

## References

[AppCache]
  HTML Offline Web Applications, WHATWG HTML living standard, (Work in progress) October 2011, http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html.
[ChromeApps]
  Google Chrome Apps, Google, October 2010, http://code.google.com/intl/en/chrome/webstore/articles/launching.html.
[HTML5]
  HTML5 , I. Hickson, Editor, W3C Working Draft (work in progress), 25 May 2011. Latest version available at http://www.w3.org/TR/html5/ .
[MozApps]
  Mozilla Open Web Apps, Mozilla Foundation, October 2011, https://developer.mozilla.org/en/OpenWebApps/.
[WAC]
  WAC Device APIs, Daniel Coloma et al., June 2011, http://specs.wacapps.net/2.0/jun2011/
[Widgets]
  Widgets Specifications Marcos Cáceres et al., September 2011, http://www.w3.org/2008/webapps/wiki/WidgetSpecs.

### About Telefónica

Telefónica is one of the worldֳ largest telecommunications companies by market cap. Its activities are centred mainly on the fixed and mobile telephony businesses, while its broadband business is the key growth driver underpinning both. It operates in 25 countries and its customer base exceeds 264 million globally. Telefónica growth strategy is focused on the markets in which it has a strong foothold: Spain, Europe and Latin America.