views:

31

answers:

2

I am running into a bit of a problem in debugging a web application for mobile safari. The web app is a front-end for a fairly complex server-side simulation tool. The overview of how the web app works is:

  1. User is presented with a screen where they fill in values for the simulation to be performed.
  2. User clicks "run simulation" at which point an AJAX call is made to the server. A status pane on the page is updated, indicating the simulation is being run. A php script runs the simulator with the POSTed values, and sends back some javascript to first update the status bar indicating the data is being retrieved, then set up another AJAX call to request the resulting data.
  3. The server replies to this second AJAX call with the data from the simulation- a few large arrays in json format (on the order of 1-2mb of total data), along with some javascript to clear the status pane, and plot the initial step of results.
  4. The user can then use some sliders/tabs to view different plots, walk through simulation time steps, etc..

All of this works wonderfully for the major desktop browsers (IE 7+, Firefox (win, mac, linux), safari (Mac, windows), etc..). However, on mobile safari, steps 1 and 2 go fine (all javascript is executed to update the status pane, etc..) but everything falls apart at step 3- it seems as if the javascript being returned is never executed (the status pane never clears, and results are never plotted).

I have inserted some alerts to debug, but those are not executed either. Finally, I tried returning everything but the simulation data, and everything works fine (though the plots are blank) so it is something wrong in this large return of json data. The safari javascript debugger shows no errors, and I have no idea how to proceed debugging something like this. any ideas?

A: 

I can't tell you the answer to your problem, but here's how I'd debug:

  • Try to get the server to send back only a few kb of data
  • See if you can print the size of the data
  • Break down the data into smaller more manageable chunks (JSON is meant to be small anyways)

Not really an answer, like I said. More an approach.

godswearhats
Thanks for the tips. I went ahead, and reduced the simulations to only run a few timesteps. It appears that under about 512k worth of data returned, everything runs fine. Currently there are three json arrays being returned, so out of the total of say, 1mb, each is about 350k. There does seem to be some upper limit that mobile safari can handle- not sure it is the chunk size, or the total data size though. Will play around with it a bit and post any results.
MarkD
This article may shed some light: http://www.alistapart.com/articles/putyourcontentinmypocketpart2/If you go down to the "Smart phone, tiny brain" section, it says there is a 10Mb total limit - I'm guessing you're hitting that.
godswearhats
A: 

I am unable to get >8K processed in ajax.response using FF2,Prototype1.6, on winxpp Can you clarify if you are actually receiving 1-2MB directly into ajax.response and then processing it in your onSuccess?

cp