Thanks Mohamed and Arne (for responding in private)!
Arne wrote:
"Also, the onClick argument needs to be a function, so you'd have to
wrap the tab creation in an inline function or move it out into a
named function somewhere."
With your tips I got it to work, thanks again! Here's the
background.html:
<script>
function opennewtab() {
chrome.tabs.create({url: "
http://www.google.com"})
}
chrome.contextMenus.create({"title": "Take me back to Google!",
contexts:["all"], "onclick": opennewtab});
</script>
> On Thu, Aug 5, 2010 at 5:00 AM, Oscar Fröberg <
oscarfrob...@gmail.com>wrote:
>
>
>
> > This should be pretty straightforward but whatever I try I can't get a
> > right click menu option too show. What am I doing wrong?
>
> > Chrome version 6.0.472.14 dev (Windows XP)
>
> > manifest.json
>
> > {
> > "name": "My First Extension",
> > "version": "1.0",
> > "description": "The first extension that I made.",
> > "browser_action": {
> > "default_icon": "icon.png"
> > },
> > "background_page": "background.html",
> > "permissions": [
> > "contextMenus","tabs"
> > ]
> > }
>
> > background.html
>
> > var url = "
http://www.google.com";
>
> > chrome.contextMenu.create({"title": "Clickmeplz", "onclick":
> > chrome.tabs.create({"goooogle": url})});
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-extensions" group.
> > To post to this group, send email to
chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> >
chromium-extensions+unsubscr...@chromium.org<
chromium-extensions%2Bunsubscr...@chromium.org>
> > .