Is there a way to request the contents of the HTML5 application cache?
I am writing an iOS application that uses a lot of cached web content. Before loading this page when the application is disabled, I want to check if the page exists in the cache. If this is not the case, I will inform the user that they must be online to see this content; if this happens, I will continue and download it.
IOS now has its own URL caching system, and I initially suggested that I could check the cache contents as follows:
if ([[NSURLCache sharedURLCache] cachedResponseForRequest:myRequest] != nil) {
Stupid to me. It seems that the iOS cache and HTML5 cache are not connected: -cachedResponseForRequest: returns nil for any request, even when I see that the URL is in the HTML5 application cache (using the Safari web debugger).
So, is there a way I can request the contents of the HTML5 application cache? It doesn't matter if the response uses Objective-C or Javascript code, since I can always just execute the appropriate JS from Objective-C.
Caleb source share