I replaced sample.js with this code:
console.log('Start Code');
chrome.contextMenus.create( {"title":"New Item", "contexts": ["all"],
"onclick": myOnClick} );
function myOnClick() {console.log('myOnClick called');}
If I load background.html (Control-O) and reload the page, I will see
"Start Code", but I also get this error:
Uncaught TypeError: Cannot call method 'create' of undefined
In the background tab, I do not see the changes to the context menu
(even after using Reload on the Extensions tab).
Other tabs (e.g. viewing
google.com) will show the item in the context
menu, but selecting it will not show any message in the console.
I don't understand this error since the method appears to be called
and results in a new item (on other pages/tabs).
Am I missing something?
Thanks for the help.
On Dec 26, 12:14 pm, PhistucK <
phist...@gmail.com> wrote:
> Did you look at the JavaScript console of the background page?
>
> ☆*PhistucK*