Skip to content

Instantly share code, notes, and snippets.

@Xrymz
Forked from hubgit/background.js
Created September 26, 2018 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xrymz/79a7ca8c7a365bf7c29908fb2ad52b05 to your computer and use it in GitHub Desktop.
Save Xrymz/79a7ca8c7a365bf7c29908fb2ad52b05 to your computer and use it in GitHub Desktop.
Chrome extension to block common third-party background requests
var urls = [
'*://graph.facebook.com/*',
'*://platform.twitter.com/*',
'*://*.google-analytics.com/*'
];
var response = function() {
return { cancel: true };
}
chrome.webRequest.onBeforeRequest.addListener(response, { urls: urls }, ['blocking'] );
{
"name": "Block Hosts",
"version": "0.1",
"manifest_version": 2,
"background": {
"scripts": [
"background.js"
]
},
"permissions": [
"webRequest",
"webRequestBlocking",
"<all_urls>"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment