JavaScript AJAX点击事件有时不适用于Android本地浏览器 [英] Javascript AJAX Click event sometimes not working in Android native browser

查看:125
本文介绍了JavaScript AJAX点击事件有时不适用于Android本地浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用不同设备测试我的应用程序时,我在Android手机的Android浏览器中发现了一个奇怪的问题。



我的PC和手机设计几乎相同,PC和iPhone以及手机Chrome浏览器的设计都很好。

 < a type =cart_typeonclick =ajax_submit_for_new_order_session(81,true); 
return false; id =81href =javascript:void(0)>
< i class =icon-plus-sign>< / i>< / a>

以上是我的锚标签的代码,当我点击这个锚标签时,方法,有时并非如此。

我完全困惑,并且从寻找问题的这么长时间里摸不着头脑,但没有运气。

移动设备中的onclick有任何问题吗?

解决方案

通过将jQuery版本更新为1.11解决了此问题,我使用的是1.8 b / b

而不是使用 onclick 现在我正在使用 touchstart mousedown code>



这解决了所有设备中的问题。



它的代码没有问题..浏览器的延迟时间有时约为5秒。

While testing my application with different devices I found one weird problem in android browser in android phones.

I have almost same design for PC and and mobile, in PC and in iPhone and mobile Chrome browser its working fine.

<a type="cart_type" onclick="ajax_submit_for_new_order_session(81, true); 
return false;" id="81" href="javascript:void(0)">
<i class="icon-plus-sign"></i></a>

Above is the code for my anchor tag, When I click on this anchor tag sometimes its calling the specified method and sometimes its not.

I am totally confused and scratching my head from so long for finding the issue but no luck.

Is there any problem with onclick in mobile devices?

解决方案

Solved the issue by updating the jQuery version to 1.11 earlier I am using 1.8

instead of using onclick now I am using touchstart or mousedown

this Solves the problem in all devices..

Its not problem with the code.. the delay taking by the browser is sometimes about 5 sec.

这篇关于JavaScript AJAX点击事件有时不适用于Android本地浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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