开发者

Get Browser Hotkey Settings Using JavaScript/HTML5?

开发者 https://www.devze.com 2023-03-27 12:00 出处:网络
Is there any way to use JavaScript (or HTML5 if necessary) to retrieve the browser\'s current settings on hotkeys? Notice that开发者_开发技巧 I am not trying to modify the settings, just trying to ret

Is there any way to use JavaScript (or HTML5 if necessary) to retrieve the browser's current settings on hotkeys? Notice that开发者_开发技巧 I am not trying to modify the settings, just trying to retrieve it.


Sadly, your best bet for this is to use browser sniffing, and compile a list of known hotkeys.

For example, using the jQuery Client plugin, something like:

var fullscreen = {
    Windows: {
        MSIE: 'Alt+F11',
        Firefox: 'Alt+F11'
    },
    Mac: {
        Firefox: 'Shift+Command+F'
    }
};

if(fullscreen[$.client.os] && fullscreen[$.client.os][$.client.browser]) {
    // render the label
}

Of course, this is a bit of a PITA.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号