Adding custom contextMenu items for tab

1,028 views
Skip to first unread message

Sridhar

unread,
Feb 11, 2011, 4:26:55 AM2/11/11
to Chromium-extensions
Hi,

From the Context Menu API(http://code.google.com/chrome/extensions/
contextMenus.html), contextMenu items can be added to 'page',
'selection', 'link', 'editable', 'image', 'video', 'audio' or 'all'. I
have a requirement in which I would like a menuItem(s) to be added in
the contextMenu that shows up on right click of the tab(in the tab
bar).

Is it currently possible?

Regards,
Sridhar

Arne Roomann-Kurrik

unread,
Feb 14, 2011, 5:39:00 PM2/14/11
to Sridhar, Chromium-extensions
Unfortunately this is not possible.  Context menus are limited to web page DOM only.

~Arne



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


devasia

unread,
Mar 24, 2011, 2:01:41 AM3/24/11
to Chromium-extensions
Is it possible to add a context menu item to a specific dom element?
For example I need to add a context menu item to an anchor tag with
id="my-id".
Is that possible?

On Feb 15, 3:39 am, Arne Roomann-Kurrik <kur...@chromium.org> wrote:
> Unfortunately this is not possible.  Context menus are limited to web page
> DOM only.
>
> ~Arne
>
>
>
>
>
>
>
> On Fri, Feb 11, 2011 at 1:26 AM, Sridhar <sridhar...@gmail.com> wrote:
> > Hi,
>
> > From the Context Menu API(http://code.google.com/chrome/extensions/
> > contextMenus.html), contextMenu items can be added to 'page',
> > 'selection', 'link', 'editable', 'image', 'video', 'audio' or 'all'. I
> > have a requirement in which I would like a menuItem(s) to be added in
> > the contextMenu that shows up on right click of the tab(in the tab
> > bar).
>
> > Is it currently possible?
>
> > Regards,
> > Sridhar
>
> > --
> > 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.

Michael Gundlach

unread,
Mar 24, 2011, 1:14:43 PM3/24/11
to devasia, Chromium-extensions
No.  In fact, if you need to get info about the domelement clicked, other than the data sent with the contextmenu event, the only way I know is by jumping through hoops:

1. Set up a right click handler on the page that records the event target in a global variable, if it's an element that you wanted users to be able to right click.
2. Have the context menu installed in "all" contexts.
3. When the user clicks the context menu item, the background page sends a request to the page.
4. The page's onRequest handler responds by sending relevant data from the global variable, e.g. the id of the item clicked.

AdBlock has to do steps 1 through 3 so that users can right click on an element and choose "Block this ad", and then the page knows which element was clicked.

To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
Reply all
Reply to author
Forward
0 new messages