A Tiny Extension to Block (Some) YouTube Pre-Roll Video Ads
https://github.com/KyleBenzle/DotYouTube • Created by Kyle Benzle 2020 • KyleBenzle.com • kbe@mm.st
//Block some pre-roll YouTube video ads by appending a dot after youtube.com
To run/try on your PC:
-
Unzip the dot-youtube.rar
-
Open chrome and visit chrome://extensions
-
Turn on developer mode at the top-right corner
-
Select load unpacked from the top-left corner
-
Browse through the file system and select the Unzipped folder with name dot-youtube
-
The extension is loaded.
-
Now see it working
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { if (changeInfo.status === "loading" && /youtube.com/.test(changeInfo.url)) { let url = new URL(tab.url); if (!url.hostname.endsWith(".")) { url.hostname = url.hostname + "."; chrome.tabs.update(tabId, { url: url.href }); }}})