0

With Opera, I'm playing with the example extension that looks up a selected text using the contextMenu. I would like to add a menu entry in the contextMenu when the user right click in the address-bar (url-bar, omnibox and so on) I have tried In the manifest:

"page_action": {
    "default_icon": {
         "16": "icon_16.png"
    },
    "default_title": "Context Menu API - Search Selected Text"   
},

and in the background script:

chrome.contextMenus.create({
    title: "Look url up: \"%s\"",
    contexts: ["page_action"],
    onclick: searchText
});

But without success. Is that possible ? am I missing something obvious ?

Thanks F.

Xan
  • 74,770
  • 16
  • 179
  • 206
fraz
  • 29
  • 2

1 Answers1

0

I'm afraid you can only use the %s template when the context is "selection" within the document.

Also, right-clicks on the omnibar would never be routed to your extension - there isn't a context for that.

In Chrome 49+, the Page Action is the icon your extension gets in the toolbar. Previously (and, supposedly, currently in Opera) it was an icon inside the omnibox itself - but you had to expressly "show" it for each page. Only right-clicks on that icon count as "page_action" context.

Xan
  • 74,770
  • 16
  • 179
  • 206