在浏览器中捕获媒体按键事件 [英] Capture media key events in a browser
问题描述
许多键盘最近都有媒体控制键:播放/暂停,下一个,上一个等。
我不是在说这里的F1-F12键, em>
是否有可能在浏览器的网页中捕获并响应这些媒体键上的按键?我的基本测试显示它们不会触发窗口
对象上的按键事件。
内置解决方案显然非常棒,但对于我的情况,即使是扩展也没关系。是否可以编写一个Firefox / Chrome插件来做到这一点? 是的,这是可行的,并且已经完成 http://smus.com/chrome-media-keys/
也许他将与您分享源代码
Many keyboards have media control keys on them these days: Play/Pause, Next, Previous, etc.
I'm not talking about F1-F12 keys here, btw
Is it possible to capture and react to keypresses on these media keys in webpage in a browser? My rudimentary tests show that they don't fire the keypress event on the window
object.
A built-in solution would obviously be great, but for my situation, even an extension would be ok. Is it possible to write a Firefox/Chrome plugin that would do this?
Yes, it is doable and has already been done http://smus.com/chrome-media-keys/ Maybe he'll share the source code with you
这篇关于在浏览器中捕获媒体按键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!