BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Service Workers Promise to Make Web Apps Feel Native

Service Workers Promise to Make Web Apps Feel Native

Leia em Português

Developers looking to make their web apps behave more like native apps will soon have a new option with Service Worker. A service worker is a script that runs in the background, providing added functionality but doesn't need a web page or user interaction in order to work.

Currently, the best use of a service worker is to enable offline capability. Developers can register a service worker to act as a network proxy and intercept calls. These interceptions can respond with cached data and resources or generated content even if there is no network available. At Chrome Dev Summit 2014, Alex Russell demoed how a mobile web app can use the feature to provide full app functionality offline.

The service worker offline capability is programmable, which is a big change from the existing HTML5 Application Cache feature. Russell calls it a "programmable, in-browser proxy that lets you decide what to do." Because service workers run in the background and are independent of the web page, features such as background sync and push notifications have a future, but are not yet available.

In his service worker introduction, Google Developer Advocate Matt Gaunt provides a guide on how to write a basic service worker and some of the current caveats.

Google, Mozilla, and Opera are at different stages in rolling out the feature. Microsoft has indicated that they are considering support and it is one of the most requested features for IE. Apple has made no sign of supporting it for Safari.

Service workers will be enabled by default with version 40 of Chrome, but developers can check it out now in the Chrome Beta Channel. Jake Archibald maintains a list of resources for more information and the specification is available on GitHub.

Rate this Article

Adoption
Style

BT