Ticket #8412 (closed bug: wontfix)
Ajax problem on iOS with HTML5 applicationCache and web-app mode
|Reported by:||mfkahn@…||Owned by:||mfkahn@…|
This may not be a jQuery bug, however without a workaround it will affect projects such as jQuery mobile and adoption of jQuery in HTML5 apps.
On iOS (iphone/ipad etc), when a $.get is done for a resource that has been cached in the HTML5 applicationCache (applicationCache.status == 1), *and* the application is running in "web-app" mode (where the <meta name="apple-mobile-web-app-capable" content="yes"> is present in the main page, as opposed to normal "safari"/browser mode), the http status of a successful request will be set to 0 (zero), not 200.
This forces the jQuery error handler to be called. We have had to work around this by using a low-level XmlHttpRequest instead of the jquery ajax object (not just in 1.5.1, this has been an issue for a while). It might be a significant issue for developer usability on iOS, esp for jQueryMobile. Not sure if there is a bug logged at ADC about this or not.
Steps to reproduce:
- create an HTML5 app with a cache-manifest file, using an index.html page with the <meta name="apple-mobile-web-app-capable" content="yes"> tag.
- create a second something.html file, listing it in the CACHE section (or default section) of the manifest
- onReady (or whenever), do a $('#something').load('something.html').
- try this on any compatible desktop browser (safari, chrome, firefox) - should Works
- try this on iOS safari (iPad/iPod) - should work
- in iOS/safari, click "bookmark", then "add to home screen". Go to the device home screen and launch the app in full screen mode by tapping the tile. - won't work, the content won't be loaded and if you attach an error handler you'll see the http status from the xhr was 0, but the correct content was returned (last reproduced in iOS 4.1.2 on iPad).
- Owner set to mfkahn@…
- Priority changed from undecided to low
- Status changed from new to pending
- Status changed from pending to closed
- Resolution set to wontfix