Skip to content

Instantly share code, notes, and snippets.

@daniellizik-sc
Created August 31, 2016 17:38
Show Gist options
  • Save daniellizik-sc/94cea7b8cfe5f78d2a1da7c5a96f1788 to your computer and use it in GitHub Desktop.
Save daniellizik-sc/94cea7b8cfe5f78d2a1da7c5a96f1788 to your computer and use it in GitHub Desktop.
crx block scripts without adblocker/ghostery
// ghostery fucks with POST requests as well as GET
// adblocker screws with tons of stuff
// this simply blocks the GET
// needs to be in crx background with webRequest and webRequestBlocking in permissions
var host = 'd16fk4ms6rqz1v.cloudfront.net';
var blocking = [
`verical.js`
];
chrome
.webRequest
.onBeforeRequest
.addListener(details => {
var shouldBlock = blocking.filter(s => details.url.includes(s)).length > 0;
var isCrx = details.url.includes('chrome-extension');
var isSc = details.url.includes(host);
return { cancel: shouldBlock === true && isCrx === false && isSc === true };
}, {urls: ['<all_urls>']}, ['blocking']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment