javascriptajaxhtmlcachinghtml5-appcache

HTML5 App Cache for .json files?


Does App Cache work with files other than images and js/css/html ?

I'm trying to cache .json files which are later called via XMLHttpRequest on a url like resources/data/countries.json, but the browser calls home and does not use the cached file.

Inspecting the App Cache with Chrome, I can see the file. Regular files (js/css/html/images) work as expected. No error is thrown during the caching/load process.

Is the reason this just doesn't work with App Cache or is it likely something else?

Thanks!


Solution

  • I had the same issue. I would rename the file as countries.txt and serve it as text/plain mime type. On the client side you can parse the file as json.