SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
Updates on Offline
“My AppCache won’t come back” and
“ServiceWorker Tricks for Cache”
Natasha Rooney
Web Technologist
GSM Association
@thisNatasha
1
1 boring slide about me.
Aw, do we have to?
Yup! It’s relevant (sorta)
2
http://www.w3.org/Mobile/IG/
@thisNatasha
1 boring slide about me.
Aw, do we have to?
Yup! It’s relevant (sorta)
2
http://www.w3.org/Mobile/IG/
Offline
Web Apps
@thisNatasha
totemo CONFUSING desu ne?
çŽ›ă‚‰ă‚ă—ă„ă‹ă‚‰ă§ă™ă­ïŒ
3 @thisNatasha
totemo CONFUSING desu ne?
çŽ›ă‚‰ă‚ă—ă„ă‹ă‚‰ă§ă™ă­ïŒ
3
Web Storage
Key-value mapping
IndexedDB
Key-value mapping +
indexes
File Access
Reading file content
New HTML5 APIs
@thisNatasha
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...
New HTML5 APIs
@thisNatasha
4
https://marketplace.firefox.com/developers/docs/apps_offline
App Cache: COOL! How do I do it!?
@thisNatasha
4
Manifest File
But understanding App Cache comes with an
interesting story

Content vs. Shell
...
App Cache: COOL! How do I do it!?
@thisNatasha
5
shell
content
@thisNatasha
6
content
shell
@thisNatasha
Use Case mismatch lead to...
7
App Cache is a Douchebag Gotchas
1. Files always come from the App Cache, even if you are online
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
5. Non cached resources (e.g. images) will not load in a cached
page
6. No more conditional downloads, including responsive images
7. No idea how the fallback page works
8. Redirects to other domains are treated like failures
Source: http://alistapart.com/article/application-cache-is-a-douchebag
@thisNatasha
The moral of the story...
DO IT!
Shell
Javascript, CSS and HTML for the shell
● Fonts
● Sprites
● Splash screen images
(Guidance from FT Labs)
DON’T DO IT!
Content!
Disclaimer: Still a lot of opinions in this area!
8 @thisNatasha
Another solution?
9 @thisNatasha
ServiceWorker!
10
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
@thisNatasha
ServiceWorker:
ctrl.js
11
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
@thisNatasha
ServiceWorker: Caching!
12
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
@thisNatasha
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!
12
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
@thisNatasha
ServiceWorker: Caching
13
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
cont...
@thisNatasha
cont...
ServiceWorker: Caching
Also use
➔ e.respondWith(this.caches.match("shell-v1", e.request.url));
13
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
@thisNatasha
Offline? Yeah!
14 @thisNatasha
ServiceWorker: Fallbacks
15
Source: https://github.com/slightlyoff/ServiceWorker/blob/master/explainer.md
@thisNatasha
ServiceWorker: RULES
16
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
@thisNatasha
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?
17 @thisNatasha
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
18 @thisNatasha
Thanks!
19
Especially...
Alex Russell | Google
@slighltylate
Jake Archibald | Google
@jaffathecake
Jonas Sicking | Mozilla
@SickingJ
Jeremy Chone | Britesnow
@JeremyChone
@thisNatasha

Weitere Àhnliche Inhalte

Was ist angesagt?

Was ist angesagt? (10)

Devoxx 2014 monitoring
Devoxx 2014 monitoringDevoxx 2014 monitoring
Devoxx 2014 monitoring
 
Using jsPerf correctly
Using jsPerf correctlyUsing jsPerf correctly
Using jsPerf correctly
 
The Anatomy of Java Vulnerabilities
The Anatomy of Java VulnerabilitiesThe Anatomy of Java Vulnerabilities
The Anatomy of Java Vulnerabilities
 
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
 
(java2days) The Anatomy of Java Vulnerabilities
(java2days) The Anatomy of Java Vulnerabilities(java2days) The Anatomy of Java Vulnerabilities
(java2days) The Anatomy of Java Vulnerabilities
 
Anatomy of Java Vulnerabilities - NLJug 2018
Anatomy of Java Vulnerabilities - NLJug 2018Anatomy of Java Vulnerabilities - NLJug 2018
Anatomy of Java Vulnerabilities - NLJug 2018
 
summarizer12Abr16_Spring
summarizer12Abr16_Springsummarizer12Abr16_Spring
summarizer12Abr16_Spring
 
ExpertTalks Manchester September 2018
ExpertTalks Manchester September 2018ExpertTalks Manchester September 2018
ExpertTalks Manchester September 2018
 
Puppet and your Metadata - PuppetCamp London 2015
Puppet and your Metadata - PuppetCamp London 2015Puppet and your Metadata - PuppetCamp London 2015
Puppet and your Metadata - PuppetCamp London 2015
 
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
Using Axe to Add Accessibility Checks to Your Existing Selenium TestsUsing Axe to Add Accessibility Checks to Your Existing Selenium Tests
Using Axe to Add Accessibility Checks to Your Existing Selenium Tests
 

Ähnlich wie FirefoxOS Meetup - Updates on Offline in HTML5 Web Apps

High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017
High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017
High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017
Chris Fregly
 
Apache Deep Learning 201
Apache Deep Learning 201Apache Deep Learning 201
Apache Deep Learning 201
DataWorks Summit
 
Vaadin Introduction at OOP 2014
Vaadin Introduction at OOP 2014Vaadin Introduction at OOP 2014
Vaadin Introduction at OOP 2014
Johannes Eriksson
 

Ähnlich wie FirefoxOS Meetup - Updates on Offline in HTML5 Web Apps (20)

Walter api
Walter apiWalter api
Walter api
 
Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data LakeFishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data Lake
 
Scaling drupal with confidence - Tweentribune Casestudy
Scaling drupal with confidence - Tweentribune CasestudyScaling drupal with confidence - Tweentribune Casestudy
Scaling drupal with confidence - Tweentribune Casestudy
 
Spring Cloud Gateway - Nate Schutta
Spring Cloud Gateway - Nate SchuttaSpring Cloud Gateway - Nate Schutta
Spring Cloud Gateway - Nate Schutta
 
Origins of Serverless
Origins of ServerlessOrigins of Serverless
Origins of Serverless
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data Lake Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data Lake
 
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
 
Fishing Graphs in a Hadoop Data Lake by Jörg Schad and Max Neunhoeffer at Big...
Fishing Graphs in a Hadoop Data Lake by Jörg Schad and Max Neunhoeffer at Big...Fishing Graphs in a Hadoop Data Lake by Jörg Schad and Max Neunhoeffer at Big...
Fishing Graphs in a Hadoop Data Lake by Jörg Schad and Max Neunhoeffer at Big...
 
Fraud Detection with Hadoop
Fraud Detection with HadoopFraud Detection with Hadoop
Fraud Detection with Hadoop
 
Five Fabulous Sinks for Your Kafka Data. #3 will surprise you! (Rachel Pedres...
Five Fabulous Sinks for Your Kafka Data. #3 will surprise you! (Rachel Pedres...Five Fabulous Sinks for Your Kafka Data. #3 will surprise you! (Rachel Pedres...
Five Fabulous Sinks for Your Kafka Data. #3 will surprise you! (Rachel Pedres...
 
Not only SQL
Not only SQL Not only SQL
Not only SQL
 
High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017
High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017
High Performance Distributed TensorFlow with GPUs - NYC Workshop - July 9 2017
 
SpringOne Platform recap 정윀진
SpringOne Platform recap 정윀진SpringOne Platform recap 정윀진
SpringOne Platform recap 정윀진
 
Bio2RDF@BH2010
Bio2RDF@BH2010Bio2RDF@BH2010
Bio2RDF@BH2010
 
Apache Deep Learning 201
Apache Deep Learning 201Apache Deep Learning 201
Apache Deep Learning 201
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
 
Vaadin intro at GWT.create conference
Vaadin intro at GWT.create conferenceVaadin intro at GWT.create conference
Vaadin intro at GWT.create conference
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
 
Vaadin Introduction at OOP 2014
Vaadin Introduction at OOP 2014Vaadin Introduction at OOP 2014
Vaadin Introduction at OOP 2014
 

Mehr von Natasha Rooney

Mehr von 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
 

KĂŒrzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

KĂŒrzlich hochgeladen (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

FirefoxOS Meetup - Updates on Offline in HTML5 Web Apps