Search code examples
javascriptiosmobile-safarioffline-caching

Ajax Request cached on iOS AppCached


I have an HTML5 offline application doing the following things:

  1. display a page
  2. check manifest (according to specs)
  3. perform an ajax request (using Prototype) to check if online.

I have the following issue ONLY on Mobile Safari iOS (not Safari, not Chrome, not Firefox):

  • OK: Run scénario online
  • OK: Run scénario offline (plane mode)
  • OK: Stop the server OK
  • KO: Restart the server

The Ajax-Request is performed but hangs until timeout like if it was offline

WorkAround

  • OK: If I update the manifest the cache is refreshed
  • OK: If I clean cache in iOS preferences
  • KO: If I put a parameter in the ajax-request (like ?d={timemillis} )
  • KO: The ajax request is in POST
  • KO: The request has heades: Cache-Control: no-store and Pragma: no-cache
  • KO: If I kill MobileSafari and reload
  • KO: The NETWORK part of the manifest have expliclty the URL

So I do not know what to do:

  • I can't clean mobile safari storage because it also clear localStorage
  • I can't 'touch' the manifest file on the server
  • I can't be sure my user will always be in "plane mode"

Question:

  • Is there a way to force cache update ? (according to specs no)
  • Is there a way to forbidden caching of Ajax Request ? (other than manifest)
  • Is there any jsFiddle that demonstrate it works on iOS ?

Best Regards


Solution

  • After many tests it seems the MobileSafari on iOS is really buggy. My company decide to stop this Proof of Concept and wait for an improved version or a framework dealing with all bugs.