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.
精彩评论