Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad AJAX Calls error out after 30 minutes

I'm in the process of building a webapp that is meant to be used on the iPad (saved bookmark, viewport tag, etc). The webapp makes an AJAX request (using jQuery) every 2 minutes to an unsecured server (eg. no session cookies that can timeout) that returns JSON.

However, after 30 minutes, the requests stop making it to the server, and I suppose stop being sent from the iPad. I've looked at the arguments to jQuery's error callback, which show textStatus == "Error" and errorThrown == "". Yup, nothing for errorThrown, which is partly why I am mystified.

I've tried doing user-initiated AJAX calls after 30 minutes, which returned the same error. In case it wasn't clear, the javascript is still running: it's just the AJAX calls which fail. Also, this behavior doesn't happen anywhere but the iPad.

Any ideas why this is happening, or how to work around it?

like image 634
thenoviceoof Avatar asked Aug 17 '11 17:08

thenoviceoof


1 Answers

It turns out that the iPad 2 nerfs AJAX requests after 30 minutes of sitting on the same page (ex. a long-lived webapp) when using battery. There does not appear to be a user-configurable setting to change this timeout.

like image 52
thenoviceoof Avatar answered Oct 18 '22 06:10

thenoviceoof