在 Firefox 中使用 Javascript 检测键盘布局
Detect keyboard layout with Javascript, in Firefox
有没有办法在 Firefox 中检测客户端的键盘布局?
我知道 Chrome 的答案是肯定的(参见 https://developer.mozilla.org/en-US/docs/Web/API/Navigator/keyboard):
navigator.keyboard.getLayoutMap().then(function(k) { console.log(k.get('KeyQ')); } // A or Q gives a hint about the layout
其他浏览器(Firefox、Safari 等)是否有其他方式?
目前无法在 Firefox 中通过 Javascript 检测键盘布局。
该功能目前在基于 Chromium 的浏览器中处于试验阶段。对于 Firefox,您可以在此处跟踪进度:https://bugzilla.mozilla.org/show_bug.cgi?id=1469017
截至今天,该错误的最后更新时间是 2020-06-05。该线程中最后的重要帖子之一说:
[...] exposing this information is really strong fingerpintting source. Finally, Apple has already refused. So, I think that we do not need to this API.
您可以在此处关注 Mozilla 对此 API 的官方立场:https://mozilla.github.io/standards-positions/#keyboard-map
目前它被归类为“有害”,并指出:
We're concerned that this exposes keyboard layouts, which seem likely to be a significant source of fingerprinting data, in a way that does not require any user interaction.
我预计在可预见的未来 Firefox 不会支持此功能。
有没有办法在 Firefox 中检测客户端的键盘布局?
我知道 Chrome 的答案是肯定的(参见 https://developer.mozilla.org/en-US/docs/Web/API/Navigator/keyboard):
navigator.keyboard.getLayoutMap().then(function(k) { console.log(k.get('KeyQ')); } // A or Q gives a hint about the layout
其他浏览器(Firefox、Safari 等)是否有其他方式?
目前无法在 Firefox 中通过 Javascript 检测键盘布局。
该功能目前在基于 Chromium 的浏览器中处于试验阶段。对于 Firefox,您可以在此处跟踪进度:https://bugzilla.mozilla.org/show_bug.cgi?id=1469017
截至今天,该错误的最后更新时间是 2020-06-05。该线程中最后的重要帖子之一说:
[...] exposing this information is really strong fingerpintting source. Finally, Apple has already refused. So, I think that we do not need to this API.
您可以在此处关注 Mozilla 对此 API 的官方立场:https://mozilla.github.io/standards-positions/#keyboard-map
目前它被归类为“有害”,并指出:
We're concerned that this exposes keyboard layouts, which seem likely to be a significant source of fingerprinting data, in a way that does not require any user interaction.
我预计在可预见的未来 Firefox 不会支持此功能。