Prince Kumar
Prince Kumar

Reputation: 388

Is there a way to run Chrome Extension without clicking?

I was going through the documentation for creating a Chrome extension. So far I learned that there are two ways to run the extension code, either using browserAction or pageAction. However, in either of these cases a user has to click an icon manually.

I was thinking of making an extension which can help gather user statistics and I don't want users to interact every time.

Is there a way to do it? What are the events which can be used in place of onClicked which will best suit this situation?

Upvotes: 0

Views: 1646

Answers (1)

BeardFist
BeardFist

Reputation: 8201

Depending on what kind of user statistics you are trying to gather, you could have a few event listeners in your background page. For example if you were collecting urls:

 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab){
   doSomethingWithTheUrl(tab.url);
 });

If you are more specific about what kind of stats you want to gather, I can provide a more relevant example. Take a look at the available chrome APIs.

Upvotes: 1

Related Questions