2013-07-17 223 views
5

我在jquery-mobile中開發webapp時遇到了一些奇怪的問題。 當我提示提醒時,如果我觸摸頁面的某些輸入,iOS Safari & Chrome會完全凍結,我只能用任務管理器關閉它們。javascript快速凍結iOS瀏覽器

我很困惑,如果它是蘋果故障或它是我的。

一些代碼片段:

$('.checkout-comprar-button').click(function(){     
    alert("hola!!!"); 
}); 

這是事件的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> 

這是一個輸入:

<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> 

的警報後,如果我想關注一些輸入,瀏覽器會凍結。 當我強制關閉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]... 

任何幫助嗎? 謝謝

回答

9

在iOS瀏覽器中似乎有一個主要的錯誤。當我在選擇onChange事件後使用警報時,會彈出一個OK按鈕。點擊OK按鈕不會做其他任何事情。面對面,ENTIRE瀏覽器鎖定。唯一的解決方案是打家或電源按鈕並殺死瀏覽器應用程序。

截至2013年12月13日這個問題沒有解決。我已經提交給Apple。其他人也有。我無法弄清楚爲什麼他們如此緩慢地解決這個主要問題。

+0

任何想法,什麼情況下造成的嗎?任何解決方法或任何東西? – Erhannis

3

我使用了問題中發佈的代碼,無法複製問題;不過,我以前遇到過類似的問題,並找到了解決辦法。

在本地iOS應用程序的Web視圖中使用Mobile Safari時,遇到了類似的問題。在setTimout中包裝警報消息解決了我的死鎖問題。有問關於這個主題的一個問題,它是在這裏找到答案:使用Calling [JSValue callWithArguments:] locks UI when alert() is called

這個解決方案,您的這段代碼是這樣的:

$('.checkout-comprar-button').click(function(){     
    window.setTimeout(function() {alert("hola!!!");},0); 
}); 
+0

問題似乎仍然存在,截至2016年8月 - 我能夠使用此解決方案修復它以確認'確認'提示。謝謝! –

相關問題