问题
I am working on a chrome extension that allows users to open the browser_action by
pressing a keystroke that THEY have assigned from the options-page.
I would like to use document.onkeyup = function(){ Chrome.runtime.openPopup(); };
or something along those lines... I know that this Particular Extension API
(runtime.openPopup) only functions for mozilla firefox. I am building this extension
for Chrome & Opera so this is not an option for me.
How might I go about this? Would it be through adding chrome.commands API to
the manifest file; then modifying that file from options.html/options.js and reloading the extension? I've looked all
over for a way to do the method explained above and it doesn't seem
like that's possible.
Yes, Yes I know that Chrome has a built in method for customizing chrome extension
keyboard shortcuts, but like I said I want the user to be able to specify the
shortcut from the options.html page & I'm developing this extension for Opera
too. So that won't really work...
Any solutions?
I've tried Content.js--chrome.runtime.sendMessage
& Popup.js--chrome.runtime.onMessage.addeEventListener(function() {self.focus();});
来源:https://stackoverflow.com/questions/52472371/how-to-open-browser-action-from-content-js-is-it-even-possible