Adam
Adam

Reputation: 1

Creating contextMenu at Chrome load

I'm doing a chrome extension which adds 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.

Upvotes: 0

Views: 378

Answers (1)

Mohamed Mansour
Mohamed Mansour

Reputation: 40149

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.

Upvotes: 1

Related Questions