Home screen

Remy posted a screenshot to Twitter last week.

A screenshot of adactio.com on an Android device showing an Add To Home Screen prompt.

That “Add To Home Screen” dialogue is not something that Remy explicitly requested (though, of course, you can—and should—choose to add adactio.com to your home screen). That prompt appears in Chrome on Android as the result of a fairly simple algorithm based on a few factors:

  1. The website is served over HTTPS. My site is.
  2. The website has a manifest file. Here’s my JSON manifest file.
  3. The website has a Service Worker. Here’s my site’s Service Worker script (although a little birdie told me that the Service Worker script can be as basic as a blank file).
  4. The user visits the website a few times over the course of a few days.

I think that’s a reasonable set of circumstances. I particularly like that there is no way of forcing the prompt to appear.

There are some carrots in there: Want to have the user prompted to add your site to their home screen? Well, then you need to be serving on a secure connection, and you’d better get on board that Service Worker train.

Speaking of which, after I published a walkthrough of my first Service Worker, I got an email bemoaning the lack of browser support:

I was very much interested myself in this topic, until I checked on the “Can I use…” site the availability of this technology. In one word “limited”. Neither Safari nor IOS Safari support it, at least now, so I cannot use it for implementing mobile applications.

I don’t think this is the right way to think about Service Workers. You don’t build your site on top of a Service Worker—you add a Service Worker on top of your existing site. It has been explicitly designed that way: you can’t make it the bedrock of your site’s functionality; you can only add it as an enhancement.

I think that’s really, really smart. It means that you can start implementing Service Workers today and as more and more browsers add support, your site will appear to get better and better. My site worked fine for fifteen years before I added a Service Worker, and on the day I added that Service Worker, it had no ill effect on non-supporting browsers.

Oh, and according to the Webkit five year plan, Service Worker support is on its way. This doesn’t surprise me. I can’t imagine that Apple would let Google upstage them for too long with that nice “add to home screen” flow.

Alas, Mobile Safari’s glacial update cycle means that the earliest we’ll see improvements like Service Workers will probably be September or October of next year. In the age of evergreen browsers, Apple’s feast-or-famine approach to releasing updates is practically indistinguishable from stagnation.

Still, slowly but surely, game-changing technologies are landing in browsers. At the same time, the long-term problems with betting on native apps are starting to become clearer. Native apps are still ahead of what can be accomplished on the web, but it was ever thus:

The web will always be lagging behind some other technology. I’m okay with that. If anything, I see these other technologies as the research and development arm of the web. CD-ROMs, Flash, and now native apps show us what authors want to be able to do on the web. Slowly but surely, those abilities start becoming available in web browsers.

The pace of this standardisation can seem infuriatingly slow. Sometimes it is too slow. But it’s important that we get it right—the web should hold itself to a higher standard. And so the web plays the tortoise while other technologies race ahead as the hare.

It’s interesting to see how the web could take the desirable features of native—offline support, smooth animations, an icon on the home screen—without sacrificing the strengths of the web—linking, responsiveness, the lack of App Store gatekeepers. That kind of future is what Alex is calling progressive apps:

Critically, these apps can deliver an even better user experience than traditional web apps. Because it’s also possible to build this performance in as progressive enhancement, the tangible improvements make it worth building this way regardless of “appy” intent.

Flipkart recently launched something along those lines, although it’s somewhat lacking in the “enhancement” department; the core content is delivered via JavaScript—a fragile approach.

What excites me is the prospect of building services that work just fine on low-powered devices with basic browsers, but that also take advantage of all the great possibilities offered by the latest browsers running on the newest devices. Backwards compatible and future friendly.

And if that sounds like a naïve hope, then I humbly suggest that Service Workers are a textbook example of exactly that approach.

Have you published a response to this? :

Responses

Sasha Okunev

Джереми Кит о том, как предлагать пользователю Android добавить часто посещаемый сайт на Home screen adactio.com/journal/9814. Вообще крутой.

Craig Saila

Downside to being out of touch with the latest web development developments: I’m just learning about Service Workers buff.ly/1QGH1W6

# Posted by Craig Saila on Monday, November 16th, 2015 at 2:25pm

Peaceful Blue

@saila there was a keynote talk on these at the NY Velocity conf. Concise and well-done, see if you can find the video maybe.

Dean Jackson

@adactio @smfr That’s not my area, but we’ve seen a fair number of requests for Service Workers. (although not as much as e.g. <picture>)

7 Shares

# Shared by Paul Kinchla on Monday, February 8th, 2016 at 3:58pm

# Shared by Anders Tornblad on Monday, February 8th, 2016 at 3:59pm

# Shared by Stephan Zavodny on Monday, February 8th, 2016 at 5:20pm

# Shared by Chris Sundberg on Monday, February 8th, 2016 at 6:20pm

# Shared by Lattapon Yodsuwan on Tuesday, February 9th, 2016 at 1:50am

# Shared by Michael Biggs on Tuesday, February 9th, 2016 at 11:59am

# Shared by graste on Tuesday, February 9th, 2016 at 9:25pm

55 Likes

# Liked by Ryan Barrett on Monday, November 16th, 2015 at 6:51am

# Liked by Šime Vidas on Monday, November 16th, 2015 at 10:47pm

# Liked by Flaki on Monday, November 16th, 2015 at 10:56pm

# Liked by Matthew Mirande on Tuesday, November 17th, 2015 at 4:27am

# Liked by Front-End Front on Tuesday, November 17th, 2015 at 6:57pm

# Liked by Paul Kinchla on Monday, February 8th, 2016 at 4:04pm

# Liked by Dominic Magnifico on Monday, February 8th, 2016 at 4:04pm

# Liked by Micah Godbolt on Monday, February 8th, 2016 at 4:04pm

# Liked by Dave Rupert on Monday, February 8th, 2016 at 4:04pm

# Liked by Gábor Orosz on Monday, February 8th, 2016 at 4:04pm

# Liked by Mark Llobrera on Monday, February 8th, 2016 at 4:04pm

# Liked by Tyler Sticka on Monday, February 8th, 2016 at 4:04pm

# Liked by Infused Thoughts on Monday, February 8th, 2016 at 4:04pm

# Liked by Anders Tornblad on Monday, February 8th, 2016 at 4:04pm

# Liked by Mark Everitt on Monday, February 8th, 2016 at 4:04pm

# Liked by Ville-Veikko Ilén on Monday, February 8th, 2016 at 4:04pm

# Liked by Jan Skovgaard on Monday, February 8th, 2016 at 4:05pm

# Liked by Ronan Costello on Monday, February 8th, 2016 at 4:05pm

# Liked by Marc Drummond on Monday, February 8th, 2016 at 4:05pm

# Liked by Gary Finbow on Monday, February 8th, 2016 at 4:05pm

# Liked by James Madson on Monday, February 8th, 2016 at 4:05pm

# Liked by Ruud Steltenpool on Monday, February 8th, 2016 at 4:05pm

# Liked by Tom Morris on Monday, February 8th, 2016 at 4:23pm

# Liked by Mark Tranchant on Monday, February 8th, 2016 at 4:23pm

# Liked by Dan Danowski on Monday, February 8th, 2016 at 4:24pm

# Liked by Oliver Pattison on Monday, February 8th, 2016 at 4:51pm

# Liked by ge ricci on Monday, February 8th, 2016 at 4:51pm

# Liked by Hugh Isaacs II on Monday, February 8th, 2016 at 4:52pm

# Liked by Craig Morey on Monday, February 8th, 2016 at 5:18pm

# Liked by Heath Flohre on Monday, February 8th, 2016 at 5:18pm

# Liked by Gunnar Bittersmann on Monday, February 8th, 2016 at 5:35pm

# Liked by Chris Sundberg on Monday, February 8th, 2016 at 6:25pm

# Liked by vincicat on Monday, February 8th, 2016 at 6:25pm

# Liked by Josh Barr on Monday, February 8th, 2016 at 6:26pm

# Liked by Morgan Hallgren on Monday, February 8th, 2016 at 7:00pm

# Liked by Daniel Eberhardt on Monday, February 8th, 2016 at 7:01pm

# Liked by Frank Hoffmann on Monday, February 8th, 2016 at 7:33pm

# Liked by Ville on Monday, February 8th, 2016 at 8:04pm

# Liked by Giovanni Morelli on Monday, February 8th, 2016 at 8:30pm

# Liked by Angel Ponce on Monday, February 8th, 2016 at 9:33pm

# Liked by Anders Olsen Sandvik on Monday, February 8th, 2016 at 10:41pm

# Liked by vrimesot on Monday, February 8th, 2016 at 11:00pm

# Liked by Zack Hawkins on Tuesday, February 9th, 2016 at 12:31am

# Liked by Lattapon Yodsuwan on Tuesday, February 9th, 2016 at 2:10am

# Liked by Internot of Things on Tuesday, February 9th, 2016 at 7:50am

# Liked by Dave Sherratt on Tuesday, February 9th, 2016 at 9:30am

# Liked by Marco Hengstenberg on Tuesday, February 9th, 2016 at 9:31am

# Liked by Heydon on Tuesday, February 9th, 2016 at 9:50am

# Liked by Martin Moen Wulffeld on Tuesday, February 9th, 2016 at 10:56am

# Liked by Nick F on Tuesday, February 9th, 2016 at 11:14am

# Liked by graste on Tuesday, February 9th, 2016 at 9:44pm

# Liked by Tommy Juhnke on Tuesday, February 9th, 2016 at 9:44pm

# Liked by Back Pocket on Wednesday, February 10th, 2016 at 7:40am

# Liked by Paul Kinlan on Tuesday, May 24th, 2016 at 12:26am

# Liked by Tom Leadbetter on Thursday, May 26th, 2016 at 9:55am

Related posts

Going offline with microformats

The h-entry microformat and the Cache API are a perfect pairing for offline pages.

Navigation preloads in service workers

A little performance boost for your network-first service worker strategy.

The trimCache function in Going Offline …again

There’s a bug in the cache-trimming code I wrote.

Timing out

A service worker strategy for dealing with lie-fi.

Going Offline—the talk of the book

…of the T-shirt.

Related links

minimum interesting service worker

An interesting idea from Tantek for an offline page that links off to an archived copy of the URL you’re trying to reach—useful for when you’re site goes down (though not for when the user’s internet connection is down).

Tagged with

Add a Service Worker to Your Site | CSS-Tricks - CSS-Tricks

Damn, I wish I had thought of giving this answer to the prompt, “What is one thing people can do to make their website better?”

If you do nothing else, this will be a huge boost to your site in 2022.

Chris’s piece is a self-contained tutorial!

Tagged with

Service Workers | Go Make Things

Chris Ferdinandi blogs every day about the power of vanilla JavaScript. For over a week now, his daily posts have been about service workers. The cumulative result is this excellent collection of resources.

Tagged with

Adding Response Metadata to Cache API Explainer by Aaron Gustafson and Jungkee Song

This is a great proposal that would make the Cache API even more powerful by adding metadata to cached items, like when it was cached, how big it is, and how many times it’s been retrieved.

Tagged with

Request with Intent: Caching Strategies in the Age of PWAs – A List Apart

Aaron outlines some sensible strategies for serving up images, including using the Cache API from your service worker script.

Tagged with

Previously on this day

11 years ago I wrote A map to build by

We need to have a word with the web.

13 years ago I wrote Speaking, not hacking

I had fun at Build in Belfast but alas, I didn’t make it to Science Hack Day in San Francisco.

19 years ago I wrote Greenwich Mean Tribe

I’m back in my native time zone. The flight home went smoothly and after a day of napping, I’m feeling mostly human again.

20 years ago I wrote Britpacking

London was the setting on Saturday for another gathering of geeks. Patrick managed to get everyone from the last get-together to come to the big smoke (excluding Dunstan, seeing as he’s in San Francisco and all).

23 years ago I wrote Wil, Wesley and the Web

Wesley Crusher was a character in Star Trek: The Next Generation. The character is generally regarded as being the most annoying, obnoxious member of the Enterprise crew.