har*_*kin 5 javascript safari alert freeze mobile-safari
在jquery-mobile中开发webapp时,我遇到了一些奇怪的错误.当我提示警报时,如果我触摸该页面的某些输入,iOS Safari和Chrome将完全冻结,我只能通过任务管理器关闭它们.
如果它是苹果故障或者它是我的,我很困惑.
一些代码:
$('.checkout-comprar-button').click(function(){
alert("hola!!!");
});
Run Code Online (Sandbox Code Playgroud)
这是事件的div:
<div class="grp-bottombar-button checkout-comprar-button" style="width: 50% !important; float: right !important; display: block !important; padding-top: 12px;">
<span class="green-desplegable grp-bottombar-button-text">
<? echo _("checkoutcreditcard.seguircompra"); ?>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
这是输入之一:
<div class="checkout-datos-numero checkout-first-form checkout-form-field-container">
<div class="checkout-field">
<input type="tel" placeholder="<? echo _('creditcard.numero'); ?>" name="" id="checkout-num-tarjeta" maxlength="30" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
显示警报后,如果我想要关注一些输入,浏览器会冻结.当我强制关闭Safari时,这是控制台给我的消息:
<Warning>: MobileSafari[2985] has active assertions beyond permitted time:
{(
<BKProcessAssertion: 0x1e857480> identifier: Suspending process: MobileSafari[2985] permittedBackgroundDuration: 10.000000 reason: suspend owner pid:26 preventSuspend preventThrottleDownCPU preventThrottleDownUI
)}
<Warning>: Forcing crash report of MobileSafari[2985]...
Run Code Online (Sandbox Code Playgroud)
有帮助吗?谢谢
小智 10
iOS浏览器中似乎存在MAJOR错误.当我在选择的onChange事件后使用警报时,会弹出一个OK按钮.单击"确定"按钮不会执行任何其他操作.面对面,整个浏览器锁定.唯一的解决方案是点击主页或电源按钮并终止浏览器应用程序.
截至2013年12月13日,此问题尚未解决.我已经提交给了Apple.其他人也有.我无法弄清楚为什么他们如此缓慢地解决这个主要问题.
小智 5
我使用了问题中发布的代码,但无法复制该问题;不过,我以前也遇到过类似的问题,并找到了解决方案。
在本机 iOS 应用程序的 Web 视图中使用 Mobile Safari 时,我遇到了类似的问题。将警报消息包装在 setTimout 中为我解决了死锁问题。有人提出了关于此主题的问题,并在这里得到了解答:调用 [JSValue callWithArguments:] 当调用alert()时锁定UI
使用此解决方案,您的代码将如下所示:
$('.checkout-comprar-button').click(function(){
window.setTimeout(function () {alert("hola!!!");},0);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4098 次 |
| 最近记录: |