0

This is question logically follows this question:

Is HTML5 application caching relevant?

It is obvious that popular sites are not using HTML 5 application caching to save static resources as it was designed for.

Just check for the manifest attribute in the <html> tag. It is not there.

Looking into it further HTML5 localStorage is not being used either.

As a test case I looked at

  • www.google.com
  • www.twitter.com
  • www.facebook.com

Just go into the console and type

localStorage.

and the console should pop up a list of keys.

None of these sites saves their static data to the disk?

Why is this?

It seems like a waste of resources to hit the network for a resource that has not changed.

To elaborate. If you click reload, the page will re-download static resources. With Google you can even see the word static used in the URL path. However for this question I use the conceptual meaning of the word.

Community
  • 1
  • 1
  • Most likely because it's not worth the hassle, and could scare users away with warning messages. I think the first point is the main one though; they have to support old browsers or they lose half their market, so why should they make the same functionality twice? (twice the maintenance, twice the development time, twice the bugs) – Dave Mar 20 '13 at 23:18
  • By the way: your Stack Overflow profile’s “About Me” section isn’t really designed for copying your questions into. – Paul D. Waite Mar 20 '13 at 23:34
  • Static assets such as stylesheets and javascripts are only fetched once while browsing a website. Reloading a page by pressing "reload" button makes it ignore the cache. But you would rarely do that. – Simon Perepelitsa Mar 21 '13 at 00:17

1 Answers1

6

It is obvious that popular sites are not using HTML 5 application caching to save static resources as it was designed for.

You’ve misunderstood what application caching was designed for. Here’s the first paragraph of the application cache spec:

In order to enable users to continue interacting with Web applications and documents even when their network connection is unavailable — for instance, because they are traveling outside of their ISP's coverage area — authors can provide a manifest which lists the files that are needed for the Web application to work offline and which causes the user's browser to keep a copy of the files for use offline.

http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#introduction-5

So, application caching was designed to allow web app authors to make their apps work when a network connection isn’t available.

I can’t envisage how Google, Twitter or Facebook could usefully work without a network connection. They all rely on the user interacting with enormous amounts of data (in Twitter and Facebook’s case, data about other users) on their servers. They’re inherently useless without a network connection.

Likewise, localStorage isn’t designed for storing page resources that may change. (I presume you’re suggesting that these sites could store CSS, JavaScript and image files in localStorage — apologies if I’ve misunderstood.)

This specification introduces two related mechanisms, similar to HTTP session cookies, for storing structured data on the client side...

The first is designed for scenarios where the user is carrying out a single transaction, but could be carrying out multiple transactions in different windows at the same time...

The second storage mechanism is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons...

http://www.w3.org/TR/webstorage/#introduction

In order to use localStorage for CSS, JavaScript and image files, you’d need some JavaScript in the page that checked localStorage for each resource required by the page, then (somehow) checked the server to see if there was a newer version, grabbing it if necessary, then added the resource to the DOM of the page (and stored it in localSorage if it was new).

That’s a lot of code to basically replicate the caching that web browsers already do. And while your JavaScript is checking localStorage and the server, the page stops rendering. Whereas when the browser downloads CSS and image files itself, the page can carry on rendering whilst it does so.

Community
  • 1
  • 1
Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
  • @pure_code: could you stop adding comments with swear words in them and then deleting them? It’s not really what Stack Overflow was designed for. – Paul D. Waite Mar 20 '13 at 23:47
  • I’m sorry you don’t like my answer being on your question. Feel free to flag it so that the moderators can take a look. – Paul D. Waite Mar 20 '13 at 23:49
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/26587/discussion-between-paul-d-waite-and-pure-code) – Paul D. Waite Mar 20 '13 at 23:50
  • That’s alright. Ah, I see — yup, I did leap right in there and edit your question. I can understand that being frustrating and offensive. Sorry about that. – Paul D. Waite Mar 20 '13 at 23:55
  • If you could clarify how I’ve misunderstood your question, I might be able to make my answer more useful. – Paul D. Waite Mar 20 '13 at 23:57
  • you did what thousands to...you edited a question to something you can answer...but you did it explicitly as opposed to implicitly - which I applaud. I apologize for being dis-respectful of your time...but can you please delete your answer so that I my re-post later...using my saved copy in the profile? Thank you. It was an important question that only a few would know the answer to. SO is a site full of dicks, including myself, so be wary of that good sir. –  Mar 21 '13 at 00:30
  • + as it is a transaction based site as opposed to relationship based ... you blocked many others from answering ... –  Mar 21 '13 at 00:40
  • I'll delete my answer if you re-phrase your question, or explain to me why my answer isn't appropriate. But as the question stands, I still think my answer is correct. (I didn't block anyone else from answering. I just wrote an answer that I, and other people, thought was correct. Again, if you can explain why it's not, I'd be happy to delete my answer.) – Paul D. Waite Mar 21 '13 at 09:55
  • Ah - sorry, didn't notice you'd been suspended. I'm very happy to pick this up again when you're back. – Paul D. Waite Mar 21 '13 at 09:59