SlideShare a Scribd company logo
Updates on Offline
“My AppCache won’t come back” and
“ServiceWorker Tricks for Cache”
Natasha Rooney
Web Technologist
GSM Association
@thisNatasha
1 boring slide about me.
Aw, do we have to?
Yup! It’s relevant (sorta)
1
1 boring slide about me.
Aw, do we have to?
Yup! It’s relevant (sorta)
1
http://www.w3.org/Mobile/IG/
1 boring slide about me.
Aw, do we have to?
Yup! It’s relevant (sorta)
1
http://www.w3.org/Mobile/IG/
Offline
Web Apps
Why do we care?
2
totemo CONFUSING desu ne?
紛らわしいからですね!
3
totemo CONFUSING desu ne?
紛らわしいからですね!
3
Web Storage
Key-value mapping
IndexedDB
Key-value mapping +
indexes
File Access
Reading file content
New HTML5 APIs
totemo CONFUSING desu ne?
紛らわしいからですね!
3
App Cache
BRAND NEW cache
mechanism of wonder
which will answer all your
questions of life’s worries
and fulfill your every day
with the realisation of your
dreams of riches, love,
intelligence, regular full
nights of sleep and a real
life Jurassic Park, or...
New HTML5 APIs
NOT.
4
NOT.
4
Manifest File
Content vs. Shell
...
5
5
shell
content
6
6
content
shell
NOT.
7
App Cache is a Douchebag Gotchas
1. Files always come from the App Cache, even if
you are offline
2. The App only updates if the manifest file
changes
3. The App Cache is an additional cache, not an
alternative one
4. Never future-cache the manifest
Source: http://alistapart.com/article/application-cache-is-a-douchebag
NOT.
7
App Cache is a Douchebag Gotchas
1. Non cached resources will not load in a cached
page
2. No more conditional downloads, including
responsive images
3. No idea how the fallback page works
4. Redirects to other domains are treated like
failures
Source: http://alistapart.com/article/application-cache-is-a-douchebag
Another solution?
8
ServiceWorker!
9
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
➔ New API
➔ Power to the dev!
➔ Apps, not pages - multi caches
Some quick interesting bits:
➔ Documents and Service Workers are BFFs
➔ Default Fallback: Normal resource loading
➔ Wildcards are OK
➔ 2 Service Workers are OK (default is last one)
➔ Inception is NOT OK
Register
ServiceWorker:
ctrl.js
10
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
ServiceWorker: Caching!
11
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
BREAK: Promises
① History
➔ Multilisp
➔ Java Futures
BREAK
BREAK: Promises
① Current Complexity
BREAK
Source: http://www.html5rocks.com/en/tutorials/async/deferred/
BREAK: Promises
① New Promises
BREAK
Source: http://www.html5rocks.com/en/tutorials/async/deferred/
ServiceWorker: Caching!
11
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
ServiceWorker: Caching
12
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
ServiceWorker: Caching
Also use
➔ e.respondWith(this.caches.match("shell-v1", e.request.url));
12
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
Offline? Yeah!
13
ServiceWorker: Fallbacks
14
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
ServiceWorker: RULES
15
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
1. Documents and Service workers are BFFs
2. ServiceWorkers should be written to avoid holding global
state
3. New tab means same ServiceWorker
4. Version your ServiceWorkers!
5. ServiceWorkers cannot be served on CDNs
6. CORS
7. importScripts() that run before oninstall finishes will go in
browser cache
8. Use Cache-Control: no-cache or Cache-Control: private
The bits I REALLY like...
Some cool stuff about ServiceWorkers
➔ Fallbacks for fallbacks for fallbacks
➔ It’s 100% or nothing
➔ “User chooses” or “dev chooses” both OK!
➔ Work with Quota API
➔ Works with Installed Apps
What about Network Information APIs?
16
What we learnt...
Did we learn anything?!
- The W3C cares about mobile!
- Offline solutions are confusing
- App Cache was not fit for purpose
- Shell and Content
- Service Worker
Offline as a side effect
Promises
Bit of rule following
multi cache, multi fallback
17
Thanks!
18
Especially...
Alex Russell | Google
@slighltylate
Jake Archibald | Google
@jaffathecake
Jonas Sicking | Mozilla
@SickingJ
Jeremy Chone | Britesnow
@JeremyChone

More Related Content

PDF
FirefoxOS Meetup - Updates on Offline in HTML5 Web Apps
PPT
SXSW 2012 JavaScript MythBusters
PDF
Stop JavaScripting like it's 1999
PDF
Making it Work Offline: Current & Future Offline APIs for Web Apps
PDF
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
PDF
Speed Matters!
PDF
The Case for HTTP/2 - EpicFEL Sept 2015
PDF
When it all goes wrong | PGConf EU 2019 | Will Leinweber
FirefoxOS Meetup - Updates on Offline in HTML5 Web Apps
SXSW 2012 JavaScript MythBusters
Stop JavaScripting like it's 1999
Making it Work Offline: Current & Future Offline APIs for Web Apps
Wolfram Kriesing - EcmaScript6 for real - code.talks 2015
Speed Matters!
The Case for HTTP/2 - EpicFEL Sept 2015
When it all goes wrong | PGConf EU 2019 | Will Leinweber

What's hot (20)

PDF
When it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
PDF
The Case for HTTP/2
PPTX
Novajs
PPTX
Software that eats the world! - PerformDay Brussels
PDF
Web Development Foundation & Team Collaboration
KEY
Node.js Talk at jQuery Pittsburgh
PDF
WordPress&映像配信セミナー+さぶみっと!オフ会- 第2回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
PDF
さぶみっと
PPT
Bigger Stronger Faster
PPTX
SQL Server - CLR integration
PDF
TESTING JAVA PERSISTENCE LAYER DONE RIGHT WITH ARQUILLIAN
PPTX
Web Front End Performance
PDF
Softshake 2013 - Let's take this offline
PPTX
Avatar Maven
PDF
Kubernetes Native Java
PPT
Scaling my sql_in_3d
PPT
all data everywhere
PDF
How I learned to stop worrying and love the .htaccess file
PDF
Revisiting HTTP/2
PDF
State of the resource timing api
When it all goes wrong (with Postgres) | RailsConf 2019 | Will Leinweber
The Case for HTTP/2
Novajs
Software that eats the world! - PerformDay Brussels
Web Development Foundation & Team Collaboration
Node.js Talk at jQuery Pittsburgh
WordPress&映像配信セミナー+さぶみっと!オフ会- 第2回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
さぶみっと
Bigger Stronger Faster
SQL Server - CLR integration
TESTING JAVA PERSISTENCE LAYER DONE RIGHT WITH ARQUILLIAN
Web Front End Performance
Softshake 2013 - Let's take this offline
Avatar Maven
Kubernetes Native Java
Scaling my sql_in_3d
all data everywhere
How I learned to stop worrying and love the .htaccess file
Revisiting HTTP/2
State of the resource timing api
Ad

Similar to Updates on Offline: “My AppCache won’t come back” and “ServiceWorker Tricks for Cache” (20)

PDF
Play Framework: Intro & High-Level Overview
PDF
HTTP cache @ PUG Rome 03-29-2011
PDF
Marrying Django and FastAPI - Django Day CPH 2024
PDF
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
PPTX
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
PDF
Postgres on Kubernetes - Dos and Donts.pdf
PDF
Don't screw it up! How to build durable API
PPT
Scaling drupal with confidence - Tweentribune Casestudy
PDF
The Ember.js Framework - Everything You Need To Know
PPT
Ajax to the Moon
PDF
Evoloution of Ideas
KEY
Site Performance - From Pinto to Ferrari
PDF
Scaling PHP apps
PDF
REST in peace @ IPC 2012 in Mainz
PDF
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
PDF
Offline of web applications
PDF
Offline for web - Frontend Dev Conf Minsk 2014
PDF
Origins of Serverless
PDF
The Server Side of Responsive Web Design
KEY
Socket applications
Play Framework: Intro & High-Level Overview
HTTP cache @ PUG Rome 03-29-2011
Marrying Django and FastAPI - Django Day CPH 2024
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
Postgres on Kubernetes - Dos and Donts.pdf
Don't screw it up! How to build durable API
Scaling drupal with confidence - Tweentribune Casestudy
The Ember.js Framework - Everything You Need To Know
Ajax to the Moon
Evoloution of Ideas
Site Performance - From Pinto to Ferrari
Scaling PHP apps
REST in peace @ IPC 2012 in Mainz
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Offline of web applications
Offline for web - Frontend Dev Conf Minsk 2014
Origins of Serverless
The Server Side of Responsive Web Design
Socket applications
Ad

More from Natasha Rooney (11)

PDF
MARNEW at IETF 94
PDF
Web Authentication: a Future Without Passwords?
PDF
WebAppSec Updates from W3C
PDF
JQuery UK Service Workers Talk
PDF
STV Voting System Explained
PDF
TCP and Mobile Networks Turbulent Relationship
PDF
Solving HTTP Problems With Code and Protocols
PDF
TLS Perf: from three to zero in one spec
PDF
Evolving HTTP and making things QUIC
PDF
JQuery UK February 2015: Service Workers On Vacay
PDF
GSMA in W3C
MARNEW at IETF 94
Web Authentication: a Future Without Passwords?
WebAppSec Updates from W3C
JQuery UK Service Workers Talk
STV Voting System Explained
TCP and Mobile Networks Turbulent Relationship
Solving HTTP Problems With Code and Protocols
TLS Perf: from three to zero in one spec
Evolving HTTP and making things QUIC
JQuery UK February 2015: Service Workers On Vacay
GSMA in W3C

Recently uploaded (20)

PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Machine Learning_overview_presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Encapsulation theory and applications.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
A comparative analysis of optical character recognition models for extracting...
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Machine Learning_overview_presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25-Week II
Encapsulation theory and applications.pdf
Spectroscopy.pptx food analysis technology
Assigned Numbers - 2025 - Bluetooth® Document
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Updates on Offline: “My AppCache won’t come back” and “ServiceWorker Tricks for Cache”