对于移动 Safari 来说 AJAX 响应太大?

发布于 2024-09-10 09:16:33 字数 771 浏览 0 评论 0原文

我在调试移动 Safari 的 Web 应用程序时遇到了一些问题。该 Web 应用程序是相当复杂的服务器端模拟工具的前端。 Web 应用程序的工作原理概述如下:

  1. 用户将看到一个屏幕,他们可以在其中填写要执行的模拟的值。
  2. 用户单击“运行模拟”,此时将对服务器进行 AJAX 调用。页面上的状态窗格已更新,表明模拟正在运行。 php 脚本使用 POSTed 值运行模拟器,并发送回一些 javascript 以首先更新状态栏,指示正在检索数据,然后设置另一个 AJAX 调用来请求结果数据。
  3. 服务器使用来自模拟的数据回复第二个 AJAX 调用 - 一些 json 格式的大型数组(总数据量约为 1-2mb),以及一些用于清除状态窗格并绘制初始步骤的 JavaScript结果。
  4. 然后,用户可以使用一些滑块/选项卡来查看不同的绘图、逐步执行模拟时间步骤等。

所有这些对于主要桌面浏览器(IE 7+、Firefox(win、mac、linux)、safari(Mac 、窗户)等)。然而,在移动 safari 上,步骤 1 和 2 进展顺利(所有 javascript 都被执行以更新状态窗格等...),但在步骤 3 中一切都崩溃了 - 似乎返回的 javascript 从未执行过(状态窗格)永远不会清除,并且永远不会绘制结果)。

我插入了一些警报进行调试,但这些警报也没有执行。最后,我尝试返回除模拟数据之外的所有内容,并且一切正常(尽管绘图是空白的),因此在返回大量 json 数据时出现问题。 safari javascript 调试器没有显示任何错误,我不知道如何继续调试这样的东西。有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萧瑟寒风 2024-09-17 09:16:33

我无法告诉您问题的答案,但这是我的调试方法:

  • 尝试让服务器仅发回几 kb 的数据
  • 看看是否可以打印数据的大小
  • 将数据分解为更小的数据更易于管理的块(无论如何,JSON 都应该很小)

,就像我说的那样,这并不是一个真正的答案。更多的是一种方法。

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.

小霸王臭丫头 2024-09-17 09:16:33

Safari(移动版和桌面版)存在一个已知问题,将 AJAX 响应大小限制为大约 512K。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文