Question

I'm working on an offline-capable application and I'd like to do an ajax call to $.get() a file on the domain that I will be caching.

Will the call still work if I'm offline? I would presume no, but I wondered if I included the static page in the offline cache if it would somehow still work.

Was it helpful?

Solution

Short answer: Yes.

If you have the file in the application cache, then all HTTP GET requests (including Ajax) will go through the cache. You can think of an Ajax GET request as an ordinary browser page load, but the results are delivered to your code rather than directly to the user.

OTHER TIPS

You can cache the responses into local storage and use the saved one when offline. See more on how to make this automatic here: http://myok12.wordpress.com/2011/08/19/building-an-almighty-data-retrieval-system-for-all-html5-webapps/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top