当从全屏 WebApp 模式(iPad3/iOS6)中的缓存清单加载侧面时,我的 javascript 代码停止。
这会导致您在前 5 秒内无法做任何事情。之后,您可以正常使用该网站。
1) 为什么 JavaScript 代码会停止?(事件问题?)
2)我该如何解决?
涉及的是:
- jquery-1.8.2.min.js
编辑:
我做了实验,发现在 onNoUpdate 和 onUpdateReady 事件之后 JavaScript 代码运行正常。在这两个事件启动之前,它会经过很长时间。所以这不是一个选择。
编辑2:
`<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;
};
}
}
}
);`