SlideShare uma empresa Scribd logo
1 de 31
Taking WebApplications Offline Matt Casto http://google.com/profiles/mattcasto
Offline Web - Oxymoron “Why would you want to use the web offline?” ,[object Object],[object Object]
Bandwidth Isn’t Ubiquitous
Traditional Caching
HTML5 App Cache ,[object Object]
http://www.whatwg.org/specs/web-apps/current-work/ multipage/offline.html ,[object Object]
CACHE MANIFEST # version 0.0.8 CACHE: index.html site.css jquery-1.4.1.js emoticon_smile.png NETWORK: noncached.html FALLBACK: / offline.html
CACHE MANIFEST # version 0.0.8 CACHE: index.html site.css jquery-1.4.1.js emoticon_smile.png NETWORK: noncached.html FALLBACK: / offline.html
CACHE MANIFEST # version 0.0.8 CACHE: index.html site.css jquery-1.4.1.js emoticon_smile.png NETWORK: noncached.html FALLBACK: / offline.html
<!DOCTYPE HTML> <htmlmanifest="manifest.cache">     <head>         <title>Hello AppCache</title>         <link href="site.css" rel="stylesheet“               type="text/css" />         <script src="jquery-1.4.1.js"               type="text/javascript"></script>     </head>     <body>         <h1>Hello AppCache!</h1>     </body> </html>
MIME type text/cache-manifest
Cached Page – First Load Page with manifest attribute is requested. The page is loaded (including referenced assets) The browser loads the manifest file and parses it. The browser loads indicated files in the background. At this point all of these resources will now be loaded from the browser’s cache!
Cached Page – Additional Load Page that the browser has cached is requested. The browser loads the file from its cache. The browser attempts to load the manifest file from the server. If changes have been made to the manifest file, all resources are re-cached. If the current page was re-cached, changes won’t show up unless the user refreshes.
Browser Support – App Cache Source – http://caniuse.com
DEMO – Simple Cached Site
if (navigator.onLine) alert(“We’re online!”); window.addEventListener(“online”, function(e) { alert(“online”); }, true); window.addEventListener(“offline”, function(e) { alert(“offline”); }, true);
Browser Support - onLine Source – http://caniuse.com
DEMO – OnLine/OffLine App
HTML5 Data Storage Key/Value data storage by the browser at either the Session or Persistent level. http://dev.w3.org/html5/webstorage/
sessionStorage.setItem(“key”, “value”); sessionStorage.getItem(“key”, “value”); sessionStorage.removeItem(“key”); sessionStorage.clear(); localStorage.setItem(“key”, “value”); localStorage.getItem(“key”, “value”); localStorage.removeItem(“key”); localStorage.clear();
Browser Support – Storage Source – http://caniuse.com
DEMO – Local Storage App
Offline Database Source – http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(HTML_5)
Browser Plug-Ins
DEMO – Developer Survey
Security Concerns
Other Concerns ,[object Object]
Logging
Printing

Mais conteúdo relacionado

Mais procurados

Souders WPO Web2.0Expo
Souders WPO Web2.0ExpoSouders WPO Web2.0Expo
Souders WPO Web2.0Expo
guest0b3d92d
 
Html5 and beyond the next generation of mobile web applications - Touch Tou...
Html5 and beyond   the next generation of mobile web applications - Touch Tou...Html5 and beyond   the next generation of mobile web applications - Touch Tou...
Html5 and beyond the next generation of mobile web applications - Touch Tou...
RIA RUI Society
 

Mais procurados (20)

Progressive Web Apps: o melhor da Web appficada
Progressive Web Apps: o melhor da Web appficadaProgressive Web Apps: o melhor da Web appficada
Progressive Web Apps: o melhor da Web appficada
 
Streamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web FrameworksStreamlining Your Applications with Web Frameworks
Streamlining Your Applications with Web Frameworks
 
Progressive Web Apps. What, why and how
Progressive Web Apps. What, why and howProgressive Web Apps. What, why and how
Progressive Web Apps. What, why and how
 
Souders WPO Web2.0Expo
Souders WPO Web2.0ExpoSouders WPO Web2.0Expo
Souders WPO Web2.0Expo
 
do u webview?
do u webview?do u webview?
do u webview?
 
Bring Your Web App to the Next Level. Wprowadzenie do Progressive Web App
Bring Your Web App to the Next Level. Wprowadzenie do Progressive Web AppBring Your Web App to the Next Level. Wprowadzenie do Progressive Web App
Bring Your Web App to the Next Level. Wprowadzenie do Progressive Web App
 
Design+Performance
Design+PerformanceDesign+Performance
Design+Performance
 
Joomlatools Platform v1.0
Joomlatools Platform v1.0Joomlatools Platform v1.0
Joomlatools Platform v1.0
 
The Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web AppThe Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web App
 
Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)
 
Progressive Enhancement
Progressive EnhancementProgressive Enhancement
Progressive Enhancement
 
High Performance Web Components
High Performance Web ComponentsHigh Performance Web Components
High Performance Web Components
 
Web Front End Performance
Web Front End PerformanceWeb Front End Performance
Web Front End Performance
 
Progressive Web Apps – the return of the web?
Progressive Web Apps – the return of the web?Progressive Web Apps – the return of the web?
Progressive Web Apps – the return of the web?
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared To
 
The Last Mile
The Last MileThe Last Mile
The Last Mile
 
Your Script Just Killed My Site
Your Script Just Killed My SiteYour Script Just Killed My Site
Your Script Just Killed My Site
 
Progressive Web App (feat. React, Django)
Progressive Web App (feat. React, Django)Progressive Web App (feat. React, Django)
Progressive Web App (feat. React, Django)
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
Html5 and beyond the next generation of mobile web applications - Touch Tou...
Html5 and beyond   the next generation of mobile web applications - Touch Tou...Html5 and beyond   the next generation of mobile web applications - Touch Tou...
Html5 and beyond the next generation of mobile web applications - Touch Tou...
 

Destaque

HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
Matt Casto
 

Destaque (6)

HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Migrating to HTML5, Migrating Silverlight to HTML5, Migration Applications t...
Migrating to HTML5,  Migrating Silverlight to HTML5, Migration Applications t...Migrating to HTML5,  Migrating Silverlight to HTML5, Migration Applications t...
Migrating to HTML5, Migrating Silverlight to HTML5, Migration Applications t...
 
Alan Downie and Matt Milosavljevic - BugHerd, the Incubator Experience
Alan Downie and Matt Milosavljevic - BugHerd, the Incubator ExperienceAlan Downie and Matt Milosavljevic - BugHerd, the Incubator Experience
Alan Downie and Matt Milosavljevic - BugHerd, the Incubator Experience
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5
 
HTML 5 Offline Web apps
HTML 5 Offline Web apps HTML 5 Offline Web apps
HTML 5 Offline Web apps
 

Semelhante a Taking Web Applications Offline

Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Ajax Experience 2009
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
Christopher Schmitt
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
Robert Nyman
 

Semelhante a Taking Web Applications Offline (20)

Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Always on! ... or not?
Always on! ... or not?Always on! ... or not?
Always on! ... or not?
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling Pagecache
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascript
 
Building WebApp with HTML5
Building WebApp with HTML5Building WebApp with HTML5
Building WebApp with HTML5
 
Building great mobile apps: Somethings you might want to know
Building great mobile apps: Somethings you might want to knowBuilding great mobile apps: Somethings you might want to know
Building great mobile apps: Somethings you might want to know
 
Local storage
Local storageLocal storage
Local storage
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Web assembly with PWA
Web assembly with PWA Web assembly with PWA
Web assembly with PWA
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
The Power of HTML5 Offline: Mobile and More!
The Power of HTML5 Offline: Mobile and More!The Power of HTML5 Offline: Mobile and More!
The Power of HTML5 Offline: Mobile and More!
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
GWT and PWA
GWT and PWAGWT and PWA
GWT and PWA
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Progressive Web Apps - Intro & Learnings
Progressive Web Apps - Intro & LearningsProgressive Web Apps - Intro & Learnings
Progressive Web Apps - Intro & Learnings
 
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
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
 

Último (20)

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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Taking Web Applications Offline

Notas do Editor

  1. There is no such thing as “offline web apps” – this is an oxymoron. However, web applications can take advantage of browser capabilities and work without a network connection.This quote goes alone with a short story about my flight earlier this week, where my upcoming presentation at CodeMash was the topic. When I told my fellow traveler what my session’s title was, this was what he said.
  2. As a case study, I describe my current contract with the State of Ohio. They have a long standing ASP.NET web application and they needed a new portion of that site to be available offline for auditors that visit homes that get state government assistance with their heating bills. These auditors need to record information about the electricity usage of appliances and suggest replacements that would use less energy (thus, saving money).
  3. Internet not available or the website is down.
  4. You (the developer) can control the cache duration through your web server’s cache settings, but its not reliable for offline use. Also, you have no control over the user’s browser settings.
  5. The HTML5 specification is more for browser developers, not web application developers, but it can give you an idea of whats going on.
  6. The cache manifest file contains instructions for the browser to determine how to cache your pages.
  7. The CACHE section includes pages you want the browser to cache, even if the user hasn’t browsed to them. Note that pages that reference the manifest file will automatically be cached, but its nice to be explicit and include them. Also note that resources, such as CSS files, javascript files and images, must be referenced in order to be loaded into the cache.
  8. The NETWORK section is where to include pages that should only be available when a network connection is available.
  9. The fallback section allows you to reference a web page to display when certain pages are requested and there is no network. You can list specific pages, or use a wild card * to define a fall back page for all non-cached pages. The fallback page is implicitly cached by the browser.
  10. The cache manifest file is referenced as an attribute on the HTML tag in your pages that “kick off” caching.
  11. You must associate the “text/cache-manifest” MIME type with the file extension you’re using for the cache manifest file. Typically the file will be named “cache.manifest” but I’m using “manifest.cache” since the “.manifest” file extension is already associated with a different MIME type in IIS 7.Note that you can’t use the ASP.NET Development Server (Cassini) to test this since you can’t set up MIME types.
  12. Step 3 is where things can go wrong. If there is a problem with ANY part of the manifest file, the whole caching process fails.
  13. Note that step 3 will fail if the user is currently working offline or has no network connection.Also, its very important to note that pages that have been changed won’t be re-loaded unless the cache manifest file has also changed.
  14. Note that each browser has a different maximum storage amount for cached pages, and there aren’t currrently any APIs or mechanisms in place for increasing that quota – its up to the user!
  15. Show a simple site and demonstrate caching. Show debug information in Chrome Developr Tools and javascript events that haven’t been covered in slides.
  16. That’s great, but what about doing real work offline … instead of just displaying cached pages?The HTML5 spec calls for a flag that indicates whether the user is online, and events that are raised when the network status changes.
  17. Pretty much the same coverage as AppCache, although webkit based browsers don’t have a “work offline” feature, which means you have to have not network connectivity to change the onLine flag – tough to test when developing against localhost. Also, webkit based browsers won’t update the onLine flag until the page is refreshed (VERIFY!!)
  18. As you can see, pretty much all major browsers support local and session key/value storage.
  19. Web SQL Database was part of the HTML5 specification for a SQLite database implementation in the browser, but several browsers have stated that they won’t support it and its currently only supported on WebKit browsers. The Indexed Database API looks more promising as far as future browser support, but it isn’t a viable solution today. Also, there have been lots of concerns about missing features in Indexed Database such as encryption.
  20. Flash has been the solution for developers who want a local database for a while now with several 3rd party database implementations. Silverlight is a good alternative for .NET developers.
  21. If you want to work offline with a browser plug-in, you don’t really want to cache a page with the plug-in as content – this doesn’t have any advantage over regular caching. Adobe Flash projects can be created to target the AIR runtime which runs out of the browser, has a native SQLite implementation, and is supported in all modern operating systems.
  22. Microsoft’s Silverlight Out of Browser (OOB) capabilities are a nice alternative to Adobe AIR for .NET developers and is supported on modern Windows and Mac operating systems. There is no support for *nix operating systems, although there’s a 3rd party implementation called Moonlight developd by Novell’s Mono team. There is currently no local database suppport, but there are open source implementations.
  23. This demonstration is an ASP.NET MVC web application that allows the user to enter survey results and submit them. There is a form for HTML5 storage and caching, there’s a form for Silverlight in and out of browser, and a page with an AIR installer. All 3 implementations of the survey form post to the save ASP.NET MVC controller action.
  24. Just like anything sent to the browser in an HTML page, anything stored in local storage, no matter what browser or plug-in is used, is available for people to access. Its also possible that users on machines that are shared by multiple users could access each other’s data. Its important to keep this in mind when developing with these features.
  25. There are lots of other things you should take into consideration if you need to build an offline capable web application; including error handling, logging, printing, authentication / authorization…If these are a big deal for you, maybe you should develop a thick client instead!