Skip to content

Instantly share code, notes, and snippets.

@scottjehl
Created December 10, 2012 17:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottjehl/4252024 to your computer and use it in GitHub Desktop.
Save scottjehl/4252024 to your computer and use it in GitHub Desktop.
HTML5 Appcache Feature Request

In response to @jaffathecake's tweet

One feature that would be extremely helpful when building with HTML5 appcache would be to request that an HTML document that references an offline cache always fetches content from the server (per ordinary caching header rules) when the network connection is available, and only "offline" when the server cannot be reached.

An example use case would be simple HTML document that refreshes regularly, yet should be available to browse offline, should the connection drop upon refreshing the page.

Here's a use case we had when building an app on BostonGlobe.com: Our app's homepage began as a simple list of a user's bookmarked links to articles, which were available to any device (JS or no JS). That list of articles would change constantly as a user bookmarked and removed bookmarks throughout the site. In modern browsers, that same list page would be enhanced into an application in which all of the bookmarked articles were fetched via Ajax and brought into the page where they could be read in a simple, RSS-reader style interface. This was available offline as well: the HTML document itself was stored in appcache, and the fetched articles were stored in localstorage. Once stored in appcache, the HTML page itself was frozen, so we had to repopulate the list of links with an Ajax request to the live page and swap out the DOM, and that new version of the page itself was stored in localStorage as well so that it could replace out the page contents when offline too. This basically meant that every time the app is opened, the HTML inside the page is stale to the day that it was first pulled down.

@scottjehl
Copy link
Author

I should add that the current Appcache behavior makes it very hard (impossible?) to build an offline app with progressive enhancement, as any HTML document changes must be handled with JS, and it seems to skew towards JS templated approaches to HTML content.

@lyzadanger
Copy link

Online-by-default seems like it would be more forgiving in terms of resources one forgets to manage/add to the manifest, as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment