1

We have a mobile web app saved to the home screen. The application is coded using a single page HTML file with jquery mobile.

In iOS5 and below the index.html file is not cached by the device so every time the application is launched the device requests for the HTML page. This is really important because we have another application that handles authentication sitting in front of our server and therefore we rely on the 302 http code which causes a redirect to authenticate. If this is successful another redirect occurs back to our index.html page.

In iOS6 though it appears the index.html file is cached even though we set a no cache control header! This is a problem because we don't get to authenticate and therefore when the user starts using the application all requests fail (they are unauthenicated).

I can't seem to find any detail of whether this was a feature implemented in iOS6. Anyone shed any light on this? I know they went a little crazy with caching (caching post responses)...

NOTE: understand the solution of the authentication is not ideal however we can't change that at the moment. Just looking for references on what apple did to cause this bug!

Update:

Just discovered something interesting after using Charles Web Debugging Proxy that the server is responding with Cache-Control:private which means that proxies won't cache however browsers will cache. This raises the question as to whether iOS 6 home screen mobile web apps now actually treat this cache-control correctly?!? Need to investigate further what hardware in our infrastructure is adding this cache-control.

ramsinb
  • 1,985
  • 12
  • 17

3 Answers3

1

I am having the same issue with an HTML5/JQM/Jersey based application. I set the cache-control header to no-cache, which now seems to work on most of the devices but still fails intermittently on some.

Kamran
  • 829
  • 1
  • 10
  • 12
  • From my early investigation this did fix it however I wasn't sure why it behaves differently between IOS5 and IOS6. – ramsinb Oct 05 '12 at 23:35
  • This is an issue with iOS6 only. The other thing we noticed is that if you access the app using the existing saved bookmarks the browser was still caching, even after we changed the server side code to send a "no-cache" header. So we had to delete the existing bookmarks on the device and remove all the cached data. This has now seemed to fix the problem. – Kamran Oct 10 '12 at 10:32
1

I was struggling with the same issue in my application, and founded that you have to set the headers of the request with Cache-control: no-cache, in order to avoid iOS6 cache the response.

Please take a look to the following link:

Is Safari on iOS 6 caching $.ajax results?

Community
  • 1
  • 1
Milton
  • 928
  • 1
  • 10
  • 22
  • Absolutely the issue we have is that we can't control the cache control settings because something in our infrastructure is overriding. – ramsinb Oct 05 '12 at 23:31
0

If you use:

Cache-Control:no-cache, no-store

there shouldn't be any way for iOS6 to cache the AJAX calls. I suspect iOS6 actually started obeying the rules and implemented "Cache-control:private" as it was meant to work initially, while almost any other browser just treats it as 'no-cache' directive.

I had the same problem with it, while using PHP's SAJAX framework (which was set to 'private').

userfuser
  • 1,350
  • 1
  • 18
  • 32