开发者

Too large an AJAX response for mobile safari?

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 re开发者_C百科turning 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?


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.


There is a known issue with Safari (both mobile and desktop) that limits AJAX response size to about 512K.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜