开发者

How to load options.html in jQuery-colorbox, upon a context menu item click?

开发者 https://www.devze.com 2023-04-09 01:08 出处:网络
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 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:

  1. 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.

  2. 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号