user9154336
user9154336

Reputation:

Limit Chrome Extension Permissions to Certain Domain

I have a chrome extension that I have running only on a certain domain using "matches":[] in my manifest.json. However, because I need the "webNavigation" permission to run the listener script below, users are told that my extension is able to read their browsing history upon installing. I don't think this is the case, because of the aforementioned "matches."

Below is the listener script I use to run my extension's code when they get on a certain page.

chrome.webNavigation.onHistoryStateUpdated.addListener(function(details) {
    chrome.tabs.executeScript(null,{file:"content.js"});
});

Is there a way to do this without telling the user that the extension is listening to all browsing history?

Upvotes: 0

Views: 378

Answers (1)

Aefits
Aefits

Reputation: 3467

Try this

chrome.webNavigation.onHistoryStateUpdated.addListener(function(details) {
    chrome.tabs.executeScript(null,{file:"content.js"});
} ,{
url: {
    hostContains: 'foo.com'
  }
});

Upvotes: 0

Related Questions