SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

WordPress&映像配信セミナー+さぶみっと!オフ会- 第2回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会- 第2回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトWordPress&映像配信セミナー+さぶみっと!オフ会- 第2回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会- 第2回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
Hiromichi Koga
 

La actualidad más candente (20)

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

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

Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
Joseph Scott
 
Socket applications
Socket applicationsSocket applications
Socket applications
João Moura
 

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

Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Don't screw it up! How to build durable API
Don't screw it up! How to build durable API Don't screw it up! How to build durable API
Don't screw it up! How to build durable API
 
Scaling drupal with confidence - Tweentribune Casestudy
Scaling drupal with confidence - Tweentribune CasestudyScaling drupal with confidence - Tweentribune Casestudy
Scaling drupal with confidence - Tweentribune Casestudy
 
The Ember.js Framework - Everything You Need To Know
The Ember.js Framework - Everything You Need To KnowThe Ember.js Framework - Everything You Need To Know
The Ember.js Framework - Everything You Need To Know
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of Ideas
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
REST in peace @ IPC 2012 in Mainz
REST in peace @ IPC 2012 in MainzREST in peace @ IPC 2012 in Mainz
REST in peace @ IPC 2012 in Mainz
 
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Develop:BBC 2013 - Turbocharge your mobile web apps by using offlineDevelop:BBC 2013 - Turbocharge your mobile web apps by using offline
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
Origins of Serverless
Origins of ServerlessOrigins of Serverless
Origins of Serverless
 
The Server Side of Responsive Web Design
The Server Side of Responsive Web DesignThe Server Side of Responsive Web Design
The Server Side of Responsive Web Design
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
Vaadin intro at GWT.create conference
Vaadin intro at GWT.create conferenceVaadin intro at GWT.create conference
Vaadin intro at GWT.create conference
 
Cache in API Gateway
Cache in API GatewayCache in API Gateway
Cache in API Gateway
 

Más de Natasha Rooney

Más de Natasha Rooney (11)

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

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

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