Search code examples
jqueryajaxhtmloffline-modeoffline-caching

Using Ajax with Offline Cache


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.


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.