从webapp中的缓存清单加载时,Javascript停止

sku*_*3r7 5 javascript web-applications cache-manifest

当侧面从全屏WebApp模式(iPad3/iOS6)中的缓存清单加载时,我的javascript代码停止.

这导致你在前5秒内无法做任何事情.之后,您可以正常使用该网站.

1)为什么JavaScript代码会停止?(事件有问题?)
2)我该如何解决?

涉及的是:

  • jQuery的1.8.2.min.js

编辑:

我已经进行了实验,发现JavaScript代码在事件onNoUpdate和onUpdateReady之后正常运行.在这两个事件开始之前,它会经过很长时间.所以这不是一个选择.

EDIT2:

`<script type="text/javascript">

    $(document).bind('touchmove', false);


    $(document).ready(function () {
        applicationCache.onupdateready = function () {
            if (confirm("Ihre Applikation wurde aktualisiert. Soll die Darstellung neu geladen werden?")) {
                window.location.reload();
            }
        }
        applicationCache.onnoupdate = function () {

        }


        var a = document.getElementsByTagName("a");
        for (var i = 0; i < a.length; i++) {
            if (a[i].className.match("noeffect")) {
                // Here happens nothing
            }
            else {
                a[i].onclick = function () {
                    load();
                    window.location = this.getAttribute("href");
                    return false;
                };
            }
        }
    }
);`
Run Code Online (Sandbox Code Playgroud)

Ron*_*ell 0

尝试在关键位置插入一些日志,以准确找出代码中发生暂停的位置。通常当你把范围缩小得足够大时,答案就会变得清晰。