如何确保在Firefox桌面浏览器中启用触摸事件? [英] How to make sure touch events are enabled in Firefox desk top browser?

查看:417
本文介绍了如何确保在Firefox桌面浏览器中启用触摸事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个带有触摸功能的Windows 7桌面上使用了一个简单的测试。
为简单起见,就像这样:
$ b $ pre $ temp_div.addEventListener('touchstart',function(e){/ (e){/ *确认* /},假)
temp_div.addEventListener('mousedown',函数(e) {/ * confirm * /},false)

在chrome中,'touchstart'被确认。
在IE中,指针被确认。
在Firefox中,mousedown被证实。



在排除故障之后,我最终不得不去Firefox中的about:config和
将'dom.w3c_touch_events.enabled'的值从0更改为1.这导致'touchstart'在Firefox中得到确认。

我的问题是这样的:



不应该在支持触摸的机器上启用它吗?
IE和Chrome配置正确,Firefox不是。 (这是一个全新的Firefox 31下载)。

有没有办法在这种情况下远程启用触摸事件,以便Firefox的行为与其他浏览器类似?

感谢解决方案

为了在桌面上启用触摸事件在Firefox的版本中,在浏览器的地址栏输入about:config,点击我会小心的,我保证!按钮并向下滚动,直到找到dom.w3c_touch_events.enabled....当您单击此项目时,会出现一个对话框,允许您更改该设置的值。



disable =(0)enable =(1)auto-detect =(2)

默认情况下应该设置为自动检测但是目前,Firefox的桌面版本被设置为禁用,由于一些bugginess。

关于这个设置的信息可以在这里找到:
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Touch_events



摘录:

dom.w3c_touch_events.enabled三态偏好可以用来禁用(0),启用(1)和自动检测(2)支持标准触摸事件;默认情况下,它们处于自动检测(2)。更改首选项后,必须重新启动浏览器才能使更改生效。


$ b 注意:从Gecko 24.0开始,Gecko 18.0引入的触摸事件支持已被禁用在桌面版的Firefox上,因为包括Google和Twitter在内的一些热门网站都无法正常工作。一旦错误得到解决,API将再次启用。

包括适用于Android和Firefox OS的Firefox的移动版本不受此更改的影响。此外,在Windows 8的Metro风格版Firefox上启用了API。


I used a simple test on a windows 7 desktop with touch capabilities. For simplicity it was something like this:

temp_div.addEventListener('touchstart', function(e){ /*confirm */ }, false)
temp_div.addEventListener('pointerdown', function(e){ /*confirm */ }, false)
temp_div.addEventListener('mousedown', function(e){ /*confirm */ }, false)

In chrome, the 'touchstart' was confirmed. In IE, the 'pointerdown' was confirmed. In Firefox, the 'mousedown' was confirmed.

After troubleshooting, I ultimately had to go to 'about:config' in Firefox and change the 'dom.w3c_touch_events.enabled' value from 0 to 1. This caused the 'touchstart' to be confirmed in Firefox.

My questions are these:

Shouldn't this have already been enabled on a touch-capable machine? IE and Chrome were configured properly and Firefox was not. (This was a brand new download of Firefox 31).

Is there anyway to enable touch events remotely in a case like this so that Firefox behaves similarly to the other browsers?

Thanks

解决方案

In order to enable touch events in the desktop version of Firefox, type "about:config" into the address bar of the browser, click the "I'll be careful, I promise!" button and scroll down until you find "dom.w3c_touch_events.enabled" ....when you click this item, a dialog box will appear that allows you to change the value of the setting.

disable=(0) enable=(1) auto-detect=(2)

This should be set to "auto-detect" by default, but currently, the desktop version of Firefox is set to "disable" due to some bugginess.

Info about this setting can be found here: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Touch_events

excerpt:

The dom.w3c_touch_events.enabled tri-state preference can be used to disable (0), enable(1), and auto-detect(2) support for standard touch events; by default, they're on auto-detect(2). After changing the preference, you must restart the browser for the changes to take effect.

Note: As of Gecko 24.0, the touch events support introduced with Gecko 18.0 has been disabled on the desktop version of Firefox, as some popular sites including Google and Twitter are not working properly. Once the bug is fixed, the API will be enabled again.
The mobile versions including Firefox for Android and Firefox OS are not affected by this change. Also, the API has been enabled on the Metro-style version of Firefox for Windows 8.

这篇关于如何确保在Firefox桌面浏览器中启用触摸事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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