Apple’s attack on service workers

Apple aren’t the best at developer relations. But, bad as their communications can be, I’m willing to cut them some slack. After all, they’re not used to talking with the developer community.

John Wilander wrote a blog post that starts with some excellent news: Full Third-Party Cookie Blocking and More. Safari is catching up to Firefox and disabling third-party cookies by default. Wonderful! I’ve had third-party cookies disabled for a few years now, and while something occassionally breaks, it’s honestly a pretty great experience all around. Denying companies the ability to track users across sites is A Good Thing.

In the same blog post, John said that client-side cookies will be capped to a seven-day lifespan, as previously announced. Just to be clear, this only applies to client-side cookies. If you’re setting a cookie on the server, using PHP or some other server-side language, it won’t be affected. So persistent logins are still doable.

Then, in an audacious example of burying the lede, towards the end of the blog post, John announces that a whole bunch of other client-side storage technologies will also be capped to seven days. Most of the technologies are APIs that, like cookies, can be used to store data: Indexed DB, Local Storage, and Session Storage (though there’s no mention of the Cache API). At the bottom of the list is this:

Service Worker registrations

Okay, let’s clear up a few things here (because they have been so poorly communicated in the blog post)…

The seven day timer refers to seven days of Safari usage, not seven calendar days (although, given how often most people use their phones, the two are probably interchangable). So if someone returns to your site within a seven day period of using Safari, the timer resets to zero, and your service worker gets a stay of execution. Lucky you.

This only applies to Safari. So if your site has been added to the home screen and your web app manifest has a value for the “display” property like “standalone” or “full screen”, the seven day timer doesn’t apply.

That piece of information was missing from the initial blog post. Since the blog post was updated to include this clarification, some people have taken this to mean that progressive web apps aren’t affected by the upcoming change. Not true. Only progressive web apps that have been added to the home screen (and that have an appropriate “display” value) will be spared. That’s a vanishingly small percentage of progressive web apps, especially on iOS. To add a site to the home screen on iOS, you need to dig and scroll through the share menu to find the right option. And you need to do this unprompted. There is no ambient badging in Safari to indicate that a site is installable. Chrome’s install banner isn’t perfect, but it’s better than nothing.

Just a reminder: a progressive web app is a website that

  • runs on HTTPS,
  • has a service worker,
  • and a web manifest.

Adding to the home screen is something you can do with a progressive web app (or any other website). It is not what defines progressive web apps.

In any case, this move to delete service workers after seven days of using Safari is very odd, and I’m struggling to find the connection to the rest of the blog post, which is about technologies that can store data.

As I understand it, with the crackdown on setting third-party cookies, trackers are moving to first-party technologies. So whereas in the past, a tracking company could tell its customers “Add this script element to your pages”, now they have to say “Add this script element and this script file to your pages.” That JavaScript file can then store a unique idenitifer on the client. This could be done with a cookie, with Local Storage, or with Indexed DB, for example. But I’m struggling to understand how a service worker script could be used in this way. I’d really like to see some examples of this actually happening.

The best explanation I can come up with for this move by Apple is that it feels like the neatest solution. That’s neat as in tidy, not as in nifty. It is definitely not a nifty solution.

If some technologies set by a specific domain are being purged after seven days, then the tidy thing to do is purge all technologies from that domain. Service workers are getting included in that dragnet.

Now, to be fair, browsers and operating systems are free to clean up storage space as they see fit. Caches, Local Storage, Indexed DB—all of those are subject to eventually getting cleaned up.

So I was curious. Wanting to give Apple the benefit of the doubt, I set about trying to find out how long service worker registrations currently last before getting deleted. Maybe this announcement of a seven day time limit would turn out to be not such a big change from current behaviour. Maybe currently service workers last for 90 days, or 60, or just 30.

Nope:

There was no time limit previously.

This is not a minor change. This is a crippling attack on service workers, a technology specifically designed to improve the user experience for return visits, whether it’s through improved performance or offline access.

I wouldn’t be so stunned had this announcement come with an accompanying feature that would allow Safari users to know when a website is a progressive web app that can be added to the home screen. But Safari continues to ignore the existence of progressive web apps. And now it will actively discourage people from using service workers.

If you’d like to give feedback on this ludicrous development, you can file a bug (down in the cellar in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying “Beware of the Leopard”).

No doubt there will still be plenty of Apple apologists telling us why it’s good that Safari has wished service workers into the cornfield. But make no mistake. This is a terrible move by Apple.

I will say this though: given The Situation we’re all living in right now, some good ol’ fashioned Hot Drama by a browser vendor behaving badly feels almost comforting.

Have you published a response to this? :

Responses

вкαя∂εℓℓ

Is your understanding that other browsers don’t have a two tiered premise like this? My understanding is that they do as well. Is it that the ones in the browser (all) can’t get cleaned up if unused? My understanding is they can/do as well.

Hiku

“Apple aren’t the best at developer relations. But, bad as their communications can be, I’m willing to cut them some slack. After all, they’re not used to talking with the developer community.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:52am

Hiku

“Only progressive web apps that have been added to the home screen (and that have an appropriate “display” value) will be spared. That’s a vanishingly small percentage of progressive web apps, especially on iOS.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:54am

Hiku

“There is no ambient badging in Safari to indicate that a site is installable. Chrome’s install banner isn’t perfect, but it’s better than nothing.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:54am

Hiku

“In any case, this move to delete service workers after seven days of using Safari is very odd, and I’m struggling to find the connection to the rest of the blog post, which is about technologies that can store data.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:55am

Hiku

“The best explanation I can come up with for this move by Apple is that it feels like the neatest solution. That’s neat as in tidy, not as in nifty. It is definitely not a nifty solution.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:56am

Hiku

“If some technologies set by a specific domain are being purged after seven days, then the tidy thing to do is purge all technologies from that domain. Service workers are getting included in that dragnet.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:56am

Hiku

“This is not a minor change. This is a crippling attack on service workers, a technology specifically designed to improve the user experience for return visits, whether it’s through improved performance or offline access.” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:58am

Hiku

“No doubt there will still be plenty of Apple apologists telling us why it’s good that Safari has wished service workers into the cornfield. But make no mistake. This is a terrible move by Apple” adactio.com/journal/16619

# Posted by Hiku on Friday, March 27th, 2020 at 4:58am

Gary Green

This change by Safari actually makes a lot of sense. Sites atm can “implicitly” install themselves forever. Even ones you casually only browse to once. With the proposed change, they can still do this but they only persist if they were explictly installed e.g. to Homescreen.

# Posted by Gary Green on Friday, March 27th, 2020 at 2:23pm

Sven Kaemper

»This is a crippling attack on service workers, a technology specifically designed to improve the user experience for return visits, whether it’s through improved performance or offline access.« ⁦@Apple#fail adactio.com/journal/16619

Scott O'Hara

You mention “added to home screen AND web app manifest has a value for the ‘display’ property like ‘standalone’ or ‘full screen’”. I thought on iOS home screen apps don’t need a manifest, they use <meta name=”apple-mobile-web-app-capable”>. Does this mean we now NEED a manifest?

St�phanie W.

Apple’s attack on service workers: “Safari continues to ignore the existence of progressive web apps. And now it will actively discourage people from using service workers.” What we can do about this? Fill a bug :/ by @adactio adactio.com/journal/16619

Julien

Always the right words from @adactio: “I will say this though: given The Situation we’re all living in right now, some good ol’ fashioned Hot Drama by a browser vendor behaving badly feels almost comforting.” All in this is true: adactio.com/journal/16619

# Posted by Julien on Monday, March 30th, 2020 at 9:29am

Morgan Roderick

I thought anything with a url could be added to the home screen? My blog can, and doesn’t use service workers or a web manifest. How would a PWA be any different?

David

Aunque siga siendo malo, no entiendo por qué es una sorpresa que Apple no quiera permitir NADA más allá de la App Store. Y eso incluye las PWAs.

# Posted by David on Thursday, April 2nd, 2020 at 7:58pm

Philip Renich

Yes, that. Thanks. That’s what is missing from the Love2Dev article - the web is a far better option than walled garden app stores, except Apple can just nix that PWA option on their hardware if they want.

12 Shares

# Shared by Pelle Wessman on Thursday, March 26th, 2020 at 3:00pm

# Shared by Paul Robert Lloyd on Thursday, March 26th, 2020 at 3:04pm

# Shared by Abbas Arezoo on Thursday, March 26th, 2020 at 3:39pm

# Shared by Bruce Lawson. At home. on Thursday, March 26th, 2020 at 3:45pm

# Shared by Kevin Marks on Thursday, March 26th, 2020 at 3:48pm

# Shared by 🔥🌏Ollie Boermans on Thursday, March 26th, 2020 at 9:14pm

# Shared by Dan Johnson on Thursday, March 26th, 2020 at 9:47pm

# Shared by Marc Friederich on Friday, March 27th, 2020 at 2:06pm

# Shared by Oliver Ash on Friday, March 27th, 2020 at 8:24pm

# Shared by Robert Novak on Sunday, March 29th, 2020 at 1:57am

# Shared by Fynn Becker on Sunday, March 29th, 2020 at 6:43pm

# Shared by minkiu on Thursday, April 2nd, 2020 at 7:38pm

22 Likes

# Liked by Chris Smith on Thursday, March 26th, 2020 at 3:17pm

# Liked by Pelle Wessman on Thursday, March 26th, 2020 at 3:17pm

# Liked by Jazz DiMauro on Thursday, March 26th, 2020 at 3:18pm

# Liked by Steve Ganz on Thursday, March 26th, 2020 at 3:18pm

# Liked by Tom on Thursday, March 26th, 2020 at 3:19pm

# Liked by Darcy Clarke (he/him) on Thursday, March 26th, 2020 at 3:20pm

# Liked by Tajinder Birdi on Thursday, March 26th, 2020 at 4:30pm

# Liked by Amber Wilson on Thursday, March 26th, 2020 at 4:30pm

# Liked by Spawn Design on Thursday, March 26th, 2020 at 4:30pm

# Liked by Jason Godesky on Thursday, March 26th, 2020 at 4:35pm

# Liked by Abbas Arezoo on Thursday, March 26th, 2020 at 4:35pm

# Liked by neuroplastic on Thursday, March 26th, 2020 at 7:19pm

# Liked by Rhy Moore on Thursday, March 26th, 2020 at 8:02pm

# Liked by Jeremy Tyarks on Thursday, March 26th, 2020 at 8:33pm

# Liked by Anna Fuster on Thursday, March 26th, 2020 at 8:34pm

# Liked by F. van Hofen on Thursday, March 26th, 2020 at 10:17pm

# Liked by Oliver Ash on Friday, March 27th, 2020 at 9:59pm

# Liked by Ajwad on Saturday, March 28th, 2020 at 5:09pm

# Liked by Fynn Becker on Sunday, March 29th, 2020 at 8:03pm

# Liked by Marc Fabre on Monday, March 30th, 2020 at 10:40am

# Liked by minkiu on Friday, April 3rd, 2020 at 11:07am

# Liked by Future Sync Conf on Thursday, April 16th, 2020 at 12:12pm

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

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

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

Round 1: post your ideas / designs · Issue #1 · works-offline/logo

This is an interesting push by Remy to try to figure out a way we can collectively indicate to users that a site works offline.

Well, seeing as browsers have completely dropped the ball on any kind of ambient badging, it’s fair enough that we take matters into our own hands.

Tagged with

Smaller HTML Payloads with Service Workers — Philip Walton

This is a great progressive enhancement for performance that uses a service worker to combine reusable bits of a page with fresh content. The numbers are very convincing!

Alas, the code is using the Workbox library, but figuring out the vanilla code to write shouldn’t be too tricky seeing as Philip talks through his logic step by step.

Tagged with

Previously on this day

9 years ago I wrote 100 words 004

Day four.

15 years ago I wrote Boarding

I’m mobile. Fly me.

18 years ago I wrote Darwinian webolution

Websites aren’t built; they’re grown.

22 years ago I wrote New Arrival

Jessica’s iMac arrived yesterday.