In my hybrid app I name web resource for instance main.css?{timestamp-file-was-modified}
and give them a year-long max-age cache header so that the clients should keep it more or less forever.
What seems to happen in my iOS app is, however, that the UIWebView
honors the cache header during the app's lifetime, i.e. when I load a new page that also includes main.css?{same-timestamp}
it won't even try to revalidate as it knows it has the right file in cache. BUT, upon a fresh launch of the app (after being killed or device switched off) the UIWebView
fetches all resources again, ignoring the cache. I've run it through Charles Proxy to verify this is the case.
I've looked inside the SQlite cache.db and I see that main.css?{same-timestamp}
is there, but still the UIWebView
won't load it from cache, causing the initial page load to be significantly slower than it could be.
I've tried it on an iPhone with iOS 8.4 and an iPad with iOS 8.2. Same result.
Any ideas?