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

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

问题描述

我在具有触摸功能的Windows 7桌面上使用了一个简单的测试. 为简单起见,它是这样的:

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)

在chrome中,已确认"touchstart". 在IE中,"pointerdown"得到确认. 在Firefox中,"mousedown"被确认.

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

经过故障排除后,我最终不得不在Firefox中转到"about:config", 将"dom.w3c_touch_events.enabled"值从0更改为1.这导致在Firefox中确认"touchstart".

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.

我的问题是这些:

此功能是否已在支持触摸功能的计算机上启用? IE和Chrome已正确配置,而Firefox未正确配置. (这是Firefox 31的全新下载).

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

在这种情况下,是否仍然可以远程启用触摸事件,以便Firefox的行为与其他浏览器相似?

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

谢谢

推荐答案

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

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)自动检测=(2)

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

默认情况下,应将其设置为自动检测",但由于某些错误,当前将桌面版Firefox设置为禁用".

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

有关此设置的信息可以在这里找到: https://developer.mozilla.org/en-US/docs/Web/Guide/事件/Touch_events

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

节选:

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

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.

注意:从Gecko 24.0开始,Firefox的桌面版本已禁用Gecko 18.0引入的触摸事件支持,因为某些受欢迎的网站(包括Google和Twitter)无法正常工作.错误修复后,将再次启用API.
包括适用于Android的Firefox和Firefox OS在内的移动版本不受此更改的影响.此外,该API已在Windows 8的Metro风格版本Firefox上启用.

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天全站免登陆