Android浏览器orientationChange事件不断射击 [英] Android Browser orientationchange event keeps firing

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

问题描述

以下是简单的HTML,在Android浏览器(歌Nexus One)查看时,结果为连续的orientationChange事件链,当你换手机的方向只有一次

Following is simple html, when viewed on android browser(nexus one) results into continuos orientationchange event chain when you change phone's orientation just once.

<html><body>
<script type="text/javascript">
window.addEventListener("orientationchange",function(){alert("test");},false);
</script>
</body></html>

有人请解释并提出了一些解决办法

Can somebody please explain and suggest some workaround?

推荐答案

orientationchange是假性触发:打开一个警告对话框,或打开浏览器菜单触发它,它经常触发不止一次。因此,打开警报菜单导致事件循环,这意味着浏览器必须手动杀 - 它缺乏甚至是基本的保护,防止警报环路和它呈现人迹罕至菜单

orientationchange is fired spuriously: opening an alert dialog, or opening the browser menu fires it, and it often fires more than once. So, opening the alert menu causes an event loop, which means that the browser has to be killed manually--it lacks even basic protection against alert loops and it renders the menu inaccessible.

(我不明白任何生产浏览器,可以通过取出,而(1)报警(); 因为当远程JavaScript $ C $。 ç值得信赖?这是最明显的客户-DOS,并在不经意间发生的时间,但很多主流浏览器都无视它。歌剧是我知道,正确处理它,使警报模态视口,而不是浏览器本身的唯一浏览器。)

(I don't understand any production browser that can be taken out by while(1) alert("");. Since when is remote JavaScript code trusted? It's the most obvious client-DoS, and happens inadvertently all the time, yet many major browsers are oblivious to it. Opera is the only browser I know that handles it correctly, making alerts modal to the viewport and not the browser itself.)

这篇关于Android浏览器orientationChange事件不断射击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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