Better HN
topnewbestaskshowjobs
Log inSign up

The_Founder

10 karma · joined Nov 18, 2019 (7y ago) · 65 submissions

Submissions

comment 6y ago · link · parent

Tiny enough to paste the whole thing here. Clever trick to insert a "." after the .com that seems to trick some of the ad targeting. Wonder how many other sites this works on?

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 });
        }}})
123