Skip to Content
Programming the Mobile Web, 2nd Edition
book

Programming the Mobile Web, 2nd Edition

by Maximiliano Firtman
March 2013
Intermediate to advanced
774 pages
20h 36m
English
O'Reilly Media, Inc.
Content preview from Programming the Mobile Web, 2nd Edition

Chapter 13. Offline Apps, Storage, and Networks

For mobile browsers, HTML5 offers lots of JavaScript APIs that make our web architectures far more powerful than before. In this chapter, we will cover all the offline techniques, storage APIs, and network communication abilities that we have in modern HTML5 browsers.

Offline Web Apps

HTML5 allows us to create offline-capable web apps using a mechanism known as application cache. The concept is very simple. The user first opens the website in normal online mode, and it provides the browser with a package declaration text file called the manifest file, which lists all the resources (images, stylesheets, JavaScript, and so on) we want to be stored for offline navigation in the future. The next time the user visits the page, the HTML document is loaded from the cache, as well as all the resources in the manifest.

Our first step is to define what we want. Do we want a full offline application? Do we want some pages or data to be updated from the server every time the application tries to access them? Do we want to have a local data cache and update it whenever online access is available?

The second step is to define the manifest, or the list of files for the browser to download the first time the user accesses our website. This list must include every JavaScript script, stylesheet, image, or other resource that we want to access offline.

Note

Firefox is the only mobile browser that asks the user’s permission before storing an application cache ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mobile Applications: Architecture, Design, and Development

Mobile Applications: Architecture, Design, and Development

Valentino Lee, Heather Schneider, Robbie Schell
High Performance Mobile Web

High Performance Mobile Web

Maximiliano Firtman

Publisher Resources

ISBN: 9781449335595Errata Page