Super simple DIY ad blocker chrome extension

Manifest.json

"permissions":[ "webRequest", "webRequestBlocker", "<all_urls>"] => We want to give permissions to chrome webRequest API, and then the last option is <all_urls>"background": { "scripts": ["adblock.js"] } => This is the reference to the JavaScript file we will have our main code in

Chrome webRequest

chrome.webRequest.onBeforeRequest => How we access the API, the event listener onBeforeRequest will fire before we send request to the url and this will be the earliest and easiest point to block the url.

Load Unpacked Extensions

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store