chrome.contextMenus.create({... "onclick": popup('http://example.com')})
calls the popup function immediately, as a result of which a popup window opens. You must pass a link to the function. To make your code work, wrap the function call in a function:
chrome.contextMenus.create({ "title": "Tumblr", "contexts": ["page", "selection", "link", "editable", "image", "video", "audio"], "onclick": function() { popup('http://example.com'); } });
window.open() can be used to create a popup window. An alternative method (just to let you know that it exists) is chrome.windows.create .
Rob w
source share