IS it possible to access web content directly from the (Safari) toolbar? I can now access it from a contextmenu, but no idea how i get the same functionaliy to a toolbar.
This is what i got:
// injected
document.addEventListener("contextmenu", handleMessage, false);
function handleMessage(msgEvent) {
var sel = '';
sel = window.parent.getSelection()+'';
safari.self.tab.setContextMenuEventUserInfo(msgEvent, sel);
}
// global
safari.application .addEventListener("command", performCommand, false);
function performCommand(event) {
console.log('performCommand');
if (event.command == "abc") {
var query = event.userInfo;
console.log(query);
alert(query);
}
}
But how do i this content directly from the toolbar ??