iPad的阿贾克斯问题 [英] iPad ajax problems

查看:133
本文介绍了iPad的阿贾克斯问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说:我必须创造这似乎工作除了iPad的(也可能是iPhone),所有设备上的聊天功能。我们的客户使用他们的iPad来聊天,所以我试图解决过去7杂交个月的问题。

Long story short: I had to create a chat functionality which seems to work on all devices except the iPad (and possibly the iPhone). Our customer uses their iPads to chat and so I have tried to solve the problems for past 7-ish months.

这是花了多长时间,我有所查明问题。

That's how long it took for me to somewhat pinpoint the problem.

这个问题显然是iPad的浏览器。我运行使用该库jQuery的JSON Ajax请求。这些要求都很好,它们不包含错误。在某些时候,iPad的只是不运行Ajax请求的。我不知道为什么,我找不到原因。每一个Ajax请求被记录,但在某些时候,服务器没有得到任何请求。我曾问一个无数次与客户积极,他们只是被锁定触摸iPad上prevent吧。

The problem is clearly in the iPad's browser. I run JSON Ajax requests using the library jQuery. The requests are fine, they do not contain errors. At some point, the iPad just doesn't run Ajax requests at all. I dont know why, I cant find why. Every Ajax request is logged, but at some point the server doesn't get any requests. I have asked a zillion times and the customer is positive they are only touching the ipad to prevent it from being locked.

我已经减少请求的速度大约每分钟15的请求,但没有奏效。

I have reduced the rate of requests to approximately 15 requests per minute, but that didn't work.

所以,我的问题是:?有人类已知的,为什么iPad的突然停止10-15分钟后发送Ajax请求的任何信息

So, my question is: Is there any information known to man why the ipad abruptly stops sending Ajax requests after 10-15 minutes?

推荐答案

把这个在这里,在注释没有任何语法高亮。

Putting this here, as in comment there isn't any syntax highlighting.

我在这里做了一个超级最小的测试页: http://www.focalstrategy.com /tests/ajax.php

I've made a super minimal test page here: http://www.focalstrategy.com/tests/ajax.php

在code是:

<?

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {

echo date("F j, Y, G:i:s a");
exit();

}

?>
<!doctype html>
<html>
<head>
    <title>AJAX test</title>
</head>
<body>
    <h1>Ajax Test</h1>
    <p>This page makes an AJAX request every 5 seconds and replaces the div below with the returned date.</p>

    <div><p id="date"><?= date("F j, Y, G:i:s a") ?></p></div>
    <div><p><span id="count">0</span> updates made.</p></div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script>
    var count = 0;

    var getDate = function() {
        $.get('/tests/ajax.php', function(data) {
            $('#date').html(data);
            count = count + 1;
            $('#count').html(count);
        });
    }
    setInterval(getDate, 5000);
    </script>

</body>
</html>

所以,我跑这一个小时,并且没有任何问题,iPad的(完全更新),在整个运行正常,没有任何遗漏。

So, I ran this for an hour, and didn't have any issues, the iPad (fully updated) ran fine throughout, without missing any.

我也跑这对Chrome浏览器并记录它的行为。这看起来是这样的:

I also ran this on Chrome and recorded it's behaviour. This looks like this:

全尺寸

有一些古怪这里,因为在事件侦听器的第一数量保持不变,再经过一段时间的推移疯狂,,增加多达56个的听众又下降到1之前。该DOM节点也算一再暴涨,高达424两者都具有相当奇怪的行为牢记这code中的简单。

There's some weirdness here, in that at first the number of event listeners stays constant, then after a while goes mad,, increasing up to 56 listeners before dropping to 1 again. The DOM Node Count also repeatedly spikes, as high as 424. Both have fairly odd behaviour bearing in mind the simplicity of this code.

也许您的应用程序被跟踪的DOM节点的数量,或事件侦听器的数量达到一定值,使iPad的失去的轨道发生了什么,或者类似的东西。

Perhaps on your app the number of Dom Nodes being tracked, or the number of event listeners is reaching some value causing the iPad to lose track of what's happening, or something similar.

这也是值得注意的是,内存使用量持续上升直到垃圾收集发生。这是什么意思的情况发生,但也许这是iPad上的低效率。

It's also worth noticing that the memory usage ramps up until garbage collection happens. That's what is meant to happen, though perhaps it's less efficient on the iPad.

编辑:我又在一个干净的轮廓进行了测试,许多事件监听器是由于扩展 - 同样的行为发生,但不是相同的程度,还背景值是0-1,而不是15-20

I've tested it again on a clean profile, many of the Event listeners are due to extensions – the same behaviour happens, but not to same degree, also background values are 0-1 rather than 15-20

这篇关于iPad的阿贾克斯问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆