Created
August 31, 2016 17:38
-
-
Save daniellizik-sc/94cea7b8cfe5f78d2a1da7c5a96f1788 to your computer and use it in GitHub Desktop.
crx block scripts without adblocker/ghostery
This file contains 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
// 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