禁用Chrome pinch缩放功能以便在自助服务终端中使用 [英] Disable Chrome pinch zoom for use in kiosk

查看:1351
本文介绍了禁用Chrome pinch缩放功能以便在自助服务终端中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在自助服务终端模式下使用Chrome,意外的是用户正在使应用程序缩放,最近又增加了对变焦的支持。
然后,他们认为他们已经破坏了它,并简单地离开应用程序(随后是一个55英寸的触摸屏),处于损坏状态。



现在只有工作一直在停止触发事件超过2点的事件传播,与此相关的问题是我们不能在这种情况下做多点触控应用程序,并且如果您的行为很快,浏览器会在javascript之前做出反应。用户。



我已经完成了Meta标签,他们不工作。老实说,我希望我可以禁用铬缩放,但我无法找到一种方法来做到这一点。



我怎样才能停止浏览器的缩放? 我们还有一个类似的问题,它表现为浏览器缩放,但JavaScript没有收到任何触摸事件(或者在缩放开始前有时只是一个单一的点)。



我们已经找到这些可能的(但可能不是长期的)解决方案:

1.禁用pinch / sw使用网亭模式时的ipe功能



如果这些命令行设置保留在Chrome中,则可以执行以下操作:

  chrome.exe --kiosk --incognito --disable-pinch --overscroll-history-navigation = 0 




  • - 禁用捏合 - 禁用捏合缩放功能

  • - overscroll-history-navigation = 0 - 禁用滑动浏览功能


。2。使用Chrome标记停用缩放缩放chrome:// flags /#enable-pinch



导航到URL chrome:// flags /#enable-pinch在您的浏览器中禁用该功能。



缩放缩放功能目前是实验性的,但默认打开,这可能意味着它将在未来的版本中启用。如果您处于自助服务终端模式(并控制硬件/软件),则可以在安装时切换此设置,然后阻止Chrome更新继续。



已经有一个在 Chromium Issue 304869 中删除此设置的路线图故障单。



事实上,浏览器在JavaScript之前反应可以防止它是一个错误,并已记录在铬错误跟踪器。希望在功能被永久启用或手指交叉之前,它将被固定,他们将把它作为一个设置。

3。禁用所有触摸功能,匹配您的应用的元素和事件的白名单



在我们进行的所有测试中,在文档中添加preventDefault() (和所有其他轻扫/触摸事件):

  document.addEventListener('touchstart',function(event){
event.preventDefault();
},{passive:false});

如果您将基于触摸的功能附加到DOM中更高的位置,到文档的preventDefault()调用。在Chrome中,包含eventListenerOptions参数也很重要,因为从Chrome 51开始,文档级事件侦听器设置为 {passive:true} 默认情况下



这会禁用像滑动一样的正常浏览器功能,你可能必须自己实现这些。如果它是一个全屏,不可滚动的自助服务终端应用,那么这些功能可能并不重要。


We are using Chrome in kiosk mode and accidentally users are causing the application to zoom with the recent addition of pinch zoom support. They then think they've broken it and simply walk away leaving the application (and subsequently a 55" touch screen) in a broken state.

Now the only thing to work has been stopping event propagation for touch events over 2 points. Issues with that are we can't do multitouch apps in that case and if you act fast the browser reacts before javascript. Which in our tests still happen on accident by users.

I've done the Meta tags, they do not work. Honestly I wish I could disable chrome zooming at all but I cant find a way to do that.

How can I stop the browser from zooming?

解决方案

We've had a similar problem, it manifests as the browser zooming but javascript receiving no touch event (or sometimes just a single point before zooming starts).

We've found these possible (but possibly not long-term) solutions:

1. Disable the pinch / swipe features when using kiosk mode

If these command-line settings remain in Chrome, you can do the following:

chrome.exe --kiosk --incognito --disable-pinch --overscroll-history-navigation=0

  • --disable-pinch - disables the pinch-to-zoom functionality
  • --overscroll-history-navigation=0 - disables the swipe-to-navigate functionality

2. Disable pinch zoom using the Chrome flags chrome://flags/#enable-pinch

Navigate to the URL chrome://flags/#enable-pinch in your browser and disable the feature.

The pinch zoom feature is currently experimental but turned on by default which probably means it will be force-enabled in future versions. If you're in kiosk mode (and control the hardware/software) you could probably toggle this setting upon installation and then prevent Chrome updates going forward.

There is already a roadmap ticket for removing this setting at Chromium Issue 304869.

The fact that the browser reacts before javascript can prevent it is definitely a bug and has been logged at the Chromium bug tracker. Hopefully it will be fixed before the feature is permanently enabled or fingers-crossed they'll leave it as a setting.

3. Disable all touches, whitelist for elements and events matching your app

In all tests that we've conducted, adding preventDefault() to the document stops the zooming (and all other swipe/touch events) in Chrome:

document.addEventListener('touchstart', function(event){
    event.preventDefault();
}, {passive: false});

If you attach your touch-based functionality higher up in the DOM, it'll activate before it bubbles to the document's preventDefault() call. In Chrome it is also important to include the eventListenerOptions parameter because as of Chrome 51 a document-level event listener is set to {passive: true} by default.

This disables normal browser features like swipe to scroll though, you would probably have to implement those yourself. If it's a full-screen, non-scrollable kiosk app, maybe these features won't be important.

这篇关于禁用Chrome pinch缩放功能以便在自助服务终端中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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