Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Problem between $.ajax in jQuery core and iOS in applicationCached/web-app mode will affect jQM #1194

mfkahn opened this Issue Mar 5, 2011 · 5 comments


None yet
4 participants

mfkahn commented Mar 5, 2011

See jQuery core issue http://bugs.jquery.com/ticket/8412
and ADC issue # 9092131 (the apple issue includes a downloadable example that demonstrates the problem)

Brief summary:

  • create a web application (perhaps with jQuery mobile) and at least with jQuery core, applying the html5 application Cache so the app runs offline. Make sure there are some $.get()/$.ajax calls in the app that fetch resources that will be present in the applicationCache ($('#this').load('that.html'))
  • set the meta tag apple-mobile-web-app-capable = yes on your main page. This allows the app to be bookmarked to the iOS home screen as a tile, and launch like an "application" (i.e. no safari URL bar etc)
  • run the app online/offline in safari - all is well, the ajax works fine (make sure applicationCache state is 1 or cached)
  • Click the "bookmark" icon and select "Add to Home Screen"
  • return to the home screen and click the new tile. App will launch in web app.full screen mode, the ajax calls to load the cache resource will fail
  • some introspection will show that the calls don't really fail, they actually return the correct content, but with an HTTP status of 0 instead of 200/304. jQuery core uses the status to trigger success/failure, so $.get suddenly stops working.

The jQuery issue got set at "low" priority, not sure of Apple's opinion yet, but I thought I would cross-post it here since it will cause strange/ugly things to happen with ajax-heavy jQuery offline mobile apps depending on how iOS users choose to bookmark, and thus might be a more significant issue for jQueryMobile.


toddparker commented Mar 14, 2011

We'll look at this. Is it related to #991?

mfkahn commented Mar 14, 2011

I don't think so, no (but maybe). The symptom is similar in that an errant HTTP status appears to be returned by the browser upon an otherwise successful request. This issue is peculiar to iOS, we've not seen it elsewhere, and it appears to be restricted to a page marked in web app mode.

jQuery core closed the bug reported there as a "wait for iOS to fix" issue, but I think it might be a little more significant for jQMobile, based on how you intend to ajax-load links.

mfkahn commented Mar 23, 2011

An update: ADC just replied and said "not a bug". I updated the issue mentioned above at jQuery core and recommended the ticket be re-opened as it is now clearly a jquery bug (if anyone wants to use it to write iOS apps). I think this will be a significant issue for jQM adoption I think, we already have to work around it on a regular basis.


hakanson commented May 18, 2011

I think jquery/jquery-mobile#1579 may overlap with this.

mfkahn commented May 31, 2011

http://bugs.jquery.com/ticket/8412 has been closed with a workaround:

on ready:
if (window.navigator.standalone) jQuery.ajaxSetup({isLocal:true});

For a mobile framework where users may or may not use "web app" modes I would consider adding that by default, though I'm not sure what the downside would be to doing so.

@johnbender johnbender closed this Oct 27, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment