Is there any API to be used to add a custom item into the chrome context menu?
For example:
Now, I wanna add a "send to ..." item to context menu(right click), when it is clicked the contents selected in the webpage will be sent to someone.
I searched the chrome APIS and found that chrome.experimental.contextMenu is competent for my requirement, however it is experimental API so something like "path_to_chrome.exe --enable-experimental-extension-apis" will be added.
Any other solutions?
Now (for long time) you have an option.
Add this permission to your manifest.json file
"permissions": ["contextMenus"]
Then, something like that will do the trick:
chrome.contextMenus.create({
'title' : 'Open this select text %s',
'contexts' : ['selection'],
'onclick' : function(info, tab) {
console.log('Selected link: ' + info.selectionText);
}
});
Good luck.
Using contextMenu
is the one and only way (outside of hacking on the Chromium source), but the API should be graduating from experimental
when Google Chrome 6 gets released to the stable channel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With