views:

240

answers:

1

I am working on an iPhone mobile web app using jqtouch to make it feel more "native". It seems that safari chokes on large Ajax responses. Is there a limit on response size? Firefox is behaving normally and small responses are working just fine. Not sure where to start on this or what tools to use in safari to help troubleshoot.

+1  A: 

You can use Safari developer tools (Web Inspector) on the desktop version, but the size limitation could very well be an iPhone-specific thing. Can you provide more information? What sizes cause the problem?

Your best bet, in general, is to chunk-load large data.

thenduks
Explain 'chunk load'?
phirschybar
Load the data in chunks. You don't supply any details, so here's an example: Say you have a contact list of 5000 people, in any system you wont want to request all 5000 from the server at once, iPhone or not -- so instead you start at offset 0 and chunk size 100 (or whatever) and when the first request is done you simply start the next one by incrementing offset to `+= chunk size`.
thenduks
Yeah I actually tried doing just that (running another ajax request when the 1st one completes, and so on). But it still timed out. We're only talking 25k - 50k or so...Anyways, I tried Safari Web Inspector (which is a nice, minimal clone of Firebug BTW, thanks for that). Turns out that on the longer the requests Safari was returning a syntax error and seemingly trying to 'run' commands of the returned ajax response content (??) Weird. Anyways, I had a small hunch it had to do with a lot of white space (tabs, new-lines, etc) so I stripped those from the response, and it worked! Still baffled
phirschybar