Created
December 28, 2017 17:07
-
-
Save davlgd/584df515f0b17042d40102f9e0def571 to your computer and use it in GitHub Desktop.
Tracking Trackers - Etape 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.browserAction.setBadgeBackgroundColor({color:"black"}); | |
var counter = 0; | |
chrome.webRequest.onCompleted.addListener(function(thisRequest) | |
{ | |
if (thisRequest.initiator) | |
{ | |
var initHost = new URL(thisRequest.initiator).host; | |
var urlHost = new URL(thisRequest.url).host; | |
if (initHost != urlHost) | |
{ | |
counter++; | |
console.log(thisRequest); | |
chrome.browserAction.setBadgeText({text:counter.toString()}); | |
} | |
} | |
},{urls: ["<all_urls>"]}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment