Get keyboard modifier when user click in toolbar command of safari extension
I want to get keyboard modifiers (like shift or option keys) when user click by toobar command of my safari extension.
In global HTML page I have next code:
safari.application.addEventListener("command", performCommand, false);
function performCommand(event)
{
if (event.command === "foo") {
//TODO: is shift pressed?
}
}
Is it possible? O开发者_开发问答r may be exists any workaround?
Unfortunately, keyCode is not currently available on the command and validate events for toolbar items. I submit enhancement request to apple.
In Safari, you should be able to do:
if (event.shiftKey) {
// Shift key was pressed...
}
精彩评论