Android 系统 WebView 85.0.4183.81 - touchmove 事件仅以 3fps 的速度触发
Android System WebView 85.0.4183.81 - touchmove event is only firing at 3fps
昨天我在 Android 10 phone 上将 Android System WebView 更新为 85.0.4182.81。之前,touchmove 事件触发 100 fps 左右,非常流畅。现在是 3 FPS。
var n = 0;
window.addEventListener('touchmove', function () {
n++;
document.body.textContent = n;
});
Touch and move here
您可能无法在此处测试代码段,因此您可以在此处进行测试:https://ghost.sk/touch.html
不要在 chrome 中测试 android,因为它有自己的 webview 版本,没有这个错误。
有办法解决这个问题吗?
编辑:解决方法是第一个被接受的答案,但这是一个真正的问题,这里是相关的错误报告:https://bugs.chromium.org/p/chromium/issues/detail?id=1123304
经过数小时的研究,我找到了解决方案 (https://bugs.chromium.org/p/chromium/issues/detail?id=1072364):
尝试在 touchmove
事件中添加 preventDefault()
:
var n = 0;
window.addEventListener('touchmove', function (e) {
n++;
document.body.textContent = n;
e.preventDefault();
}, {passive: false});
昨天我在 Android 10 phone 上将 Android System WebView 更新为 85.0.4182.81。之前,touchmove 事件触发 100 fps 左右,非常流畅。现在是 3 FPS。
var n = 0;
window.addEventListener('touchmove', function () {
n++;
document.body.textContent = n;
});
Touch and move here
您可能无法在此处测试代码段,因此您可以在此处进行测试:https://ghost.sk/touch.html 不要在 chrome 中测试 android,因为它有自己的 webview 版本,没有这个错误。 有办法解决这个问题吗?
编辑:解决方法是第一个被接受的答案,但这是一个真正的问题,这里是相关的错误报告:https://bugs.chromium.org/p/chromium/issues/detail?id=1123304
经过数小时的研究,我找到了解决方案 (https://bugs.chromium.org/p/chromium/issues/detail?id=1072364):
尝试在 touchmove
事件中添加 preventDefault()
:
var n = 0;
window.addEventListener('touchmove', function (e) {
n++;
document.body.textContent = n;
e.preventDefault();
}, {passive: false});