(Mobile) Safari loading resources despite cache manifest

1.1k Views Asked by At

I've been developing a web app that uses the offline cache, partly as a way to reduce the number of calls made to the server while in use.

I was hoping to have the login page load and cache all the resources such that all pages behind the login would not have to.

What I'm noticing from the server logs is that although all the resources (images, stylesheets, javascript files) in the manifest are requested when the login page loads, after the user has logged in, and redirected to, say, /workspace/, Safari (both desktop and mobile) seems to request the the stylesheets and javascript files listed in /workspace/ again, resulting in a HTTP 304 from the server.

While the load in serving a 304 is minimal, I'd like like to know if there was a way to avoid those. I tested the same code in Chrome (dev channel), and Chrome only requests the cache manifest again after login, and that's it.

Would appreciate any thoughts! Thanks in advance!

2

There are 2 best solutions below

1
On

I have noticed in my offline app that the host page (the one with the manifest tag in it) must be in the manifest file as well (only in iPhone iOS since 4.3), this to support startup in airline / offline mode. Perhaps this has something to do with your problem as well.

I had a problem with the offline mode in iOS 4.3 (read this for more insight in the 4.3 issue http://www.theregister.co.uk/2011/03/15/apple_ios_throttles_web_apps_on_home_screen/) however when I updated to 4.3.2 it worked again.

0
On

I have found an interesting situation with iOS 4.3.3. I have an HTML5 offline app that worked in iOS 4.2 on iPad. But I updated my iPad to iOS 4.3.1, it can no longer run in offline mode from the Home Screen. However, when I saw that "user593037" say that it was working on iOS 4.3.2, I updated my iPad again and today, its at iOS 4.3.3.

Initially my offline app still did not work offline. So I went back to the MOST basic offline web page and I used "cache.manifest" as the manifest file name it worked. So, it seems that on iOS 4.3.3 the offline caching will only work if that is the file name used for the cache manifest. I even tried with a file name of cache2.manifest and it will fail to run offline.

And you can also run it full screen with the "apple-mobile-web-app-capable" set to "yes".