BT

Service Workers Promise to Make Web Apps Feel Native

| by David Iffland Follow 4 Followers on Dec 03, 2014. Estimated reading time: 1 minute |

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 Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT