I am adding 'options' to my chrome extension. I wonder how can I user colorbox) from background page or content scripts, when context menu item is clicked.
I have spent more than a day on this without success. Is there anybody who has done this? Any 开发者_Go百科help is appreciated.
While you certainly can't use this from a background page, since colorbox shows UI, you have a few options from a content script:
You could do an XHR to fetch the contents of the background page (chrome.extension.getURL may be helpful) and write the contents of the result into the colorbox.
You could embed an
<iframe src="/path/to/options.html">
in your colorbox.
I'm assuming you know how to bind JS functions to context menus? Just in case, the contextMenu docs.
Have you tried either of these options?
精彩评论