I am trying to trigger a block of code every time the user selects/highlights some text on any of the tabs.
I am able to run the javascript when I highlight some text and then click on my extension. I have already read some of the chrome apis but none of them seem to work. https://developer.chrome.com/extensions/api_index
chrome.browserAction.onClicked.addListener(function() {
alert(window.getSelection().toString());
});
I am not able to run the code as soon as I highlight some text. Is there an API that already handles that?