Skip to main content

Bug Tracker

Side navigation

#8766 closed bug (invalid)

Opened April 04, 2011 11:27PM UTC

Closed April 22, 2011 01:30AM UTC

Bug in mobile safari involving ajax when canvas is used

Reported by: Owned by:
Priority: undecided Milestone:
Component: ajax Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Here is a link to some examples:

Here is a link to a readme about the examples:


When run as a home-screen app on iPod, the canvas is not updated when polling recursively from within the $.ajax() success callback.

In order to fully understand what is going on, please read the readme and test the examples provided. Please look at the source code as well (there is only about three lines difference between the three examples). This must be run as a home screen app on iPod.

Follow these steps to see the bug:

  • Go to the first link provided on iPod using Safari
  • Visit the first bullet point
  • Verify that it works as expected (there should be a moving bug)
  • Click the middle button on the bottom row of Safari (bookmark button)
  • Click Add to Home Screen and give it a name
  • Open the new icon on the home screen
  • Wait as long as you like, the bug will not move (if it shows up at all)

Try the other examples in the same manner and verify that they work as expected.

Steps to reproduce

  • Put an ajax callback inside of a function
  • Update a canvas element from within $.ajax() success callback
  • Call the function at the end of the success callback in $.ajax()
  • Start the loop


  • Do recursive call from within $.ajax() success with setTimeout
  • Do recursive call from outside $.ajax() success with setTimeout


The ajax calls are continually made, which means that $.ajax() does not call the error callback. I have verified this on my own webserver by outputting to the console each time an ajax call is made. The only difference is that the canvas is not updated.

My Use-Case

I have an app that polls a server and draws the updates to a canvas. In my case, the server has a setTimeout to regulate the update cycle.

Tested Platforms

  • iPod 3g running iOS 4.2.1 (8C148)
  • iPod 4g running iOS 4.3.1 (8G4)

Please email me if you would like more information. I will also submit a bug report to Apple about this.

Attachments (0)
Change History (7)

Changed April 04, 2011 11:46PM UTC by rwaldron comment:1

component: unfiledajax

Does anyone have a device to test this on? "This must be run as a home screen app on iPod." I feel like that's a little too edge.

Changed April 05, 2011 12:07AM UTC by comment:2

Well, don't you think more and more people will be using HTML5, especially for games that use ajax? I think this is a relevant concern and will make developing interactive apps simpler that work on the browser and as an "app".

Changed April 05, 2011 12:09AM UTC by rwaldron comment:3

I suspect that when you "add to homescreen" that your resource is no longer found by the ajax call. But that's just a guess without testing - Send me your ipod and I'll debug the issue and send it back.

Changed April 05, 2011 12:58AM UTC by comment:4

The resource is still being found as evidenced by the two examples that work. I can also verify that the ajax calls are being sent.

If none of your friends has an iPod or an iPhone and you really want to debug it, I might consider sending it to you. If I get time, I'll try this using a vanilla XHR and post the results to my bug report to Apple.

Maybe someone will see this bug and file a clever patch; the important thing here is that it is documented with work-arounds just in case someone else runs into the same bug.

Changed April 07, 2011 02:07PM UTC by rwaldron comment:5

keywords: → needsreview

Changed April 15, 2011 04:20PM UTC by comment:6

I implemented the Ajax call without jQuery and I got the same results.

I don't know what kind of work-around would be best, but maybe putting a short setTimeout before the success callback is called would work. This would only apply to mobile safari when run it's pinned to the home screen. I don't know if that is detectable (too specific?).

I've updated my bug report to Apple with this information, so hopefully it will be fixed soon.

Changed April 22, 2011 01:30AM UTC by dmethvin comment:7

keywords: needsreview
resolution: → invalid
status: newclosed

Reporter indicates it's not a jQuery issue so I'm closing the ticket.