开发者

Creating contextMenu at Chrome load

开发者 https://www.devze.com 2023-02-03 08:49 出处:网络
I\'m doing a chrome extension which adds开发者_如何学Python an option to right click menu in \"page\" context. I see the option added in the context menu after I click on extension\'s icon in the tool

I'm doing a chrome extension which adds开发者_如何学Python an option to right click menu in "page" context. I see the option added in the context menu after I click on extension's icon in the toolbar.

But I need the option to be added without clicking on the extension icon in the toolbar. If I add contextMenu creation code in the content script which gets injected in every page, the option is not added in the contextmenu.

What do I need to do to: add an option in the contextMenu when the user loads any webpage without clicking the extension first.


Add your context menu in the background page. http://code.google.com/chrome/extensions/background_pages.html

Background pages is a single long-running script to manage some task or state. That is where you should put it.

Hope that helped.

0

精彩评论

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