I want to be able to access keyboard shortcuts even when my tab is not selected – for example, to be able to have “push-to-talk” functionality. I suppose this would ask for permission first, like the fullscreen APIs? I essentially just want to request that a function be called for a key combination, like this:
if (requestKeyboardShortcut("Ctrl+C", function() {
//key pressed
}, function () {
//key released
})) {
//request succeeded
}
Is this possible? Is it even being considered? Thanks.
To add cross-page functionality, you’d need to rely on a browser plugin such as Java, AIR, or Silverlight, and even then I’m pretty certain this functionality wouldn’t be supported. Whichever you choose, would require elevated privileges to be able to capture the events.
I know that certain browsers have opened their APIs for JavaScript to make certain types of requests for elevated privileges, however the main reason that cross-page event capturing would be to prevent the possibility of cross-page key-logging.
Imagine you use a site that captures key events across pages, and then you open a tab and log into Gmail or your bank account. Even if you approved of a website, it could be compromised in the future.