Live data from Hacker News

A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

github.com

21–30 of 85 posts

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#21

An interesting related anecdote on this is that at least in Chrome, adblockers can also interfere with extensions' attempts to load scripts, load stylesheets, or open windows. I maintain an extension with a smallish active userbase (~20k people) and a couple different times I've encountered mysterious failures that were the result of clumsy keyword blocklists in ublock/adblock/etc - for example an extension asset (pa…

I'm puzzled. Content blocking extensions can't interfere with your extension's internals, and can't interfere with network requests made by another extension.

If your extension injects resources in the DOM, than a content blocker can interfere with the proper loading or rendering of these resources.

However I am very surprised about your statement that a content blocker extension intefered with your extension assets, my understanding is that should not be possible. You mind disclosing what is your extension?

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#23

An interesting related anecdote on this is that at least in Chrome, adblockers can also interfere with extensions' attempts to load scripts, load stylesheets, or open windows. I maintain an extension with a smallish active userbase (~20k people) and a couple different times I've encountered mysterious failures that were the result of clumsy keyword blocklists in ublock/adblock/etc - for example an extension asset (pa…

Using Little Snitch can be pretty eye-opening; I wouldn't for the life of me have imagined that my terminal installations of packages with stuff like Homebrew would send calls to Google Analytics. It's bloody everywhere.

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#24
post #7

Another protip: don't name your images "banner.jpg"; "ads.js" and "analytics.js" etc are also not exactly great names. Another protip: Always make sure that critical flows in the app won't fail if analytics event fails. You probably want to wrap calls to analytics provider with your own function, and in that function check for existence of global analytics object like "window.ga" which may fail to load due to adblock…

CloudApp had this type of problem where the CPU would crank up to 100% usage after my Pi-Hole blocked their segment.io code from functioning.

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#25

An interesting related anecdote on this is that at least in Chrome, adblockers can also interfere with extensions' attempts to load scripts, load stylesheets, or open windows. I maintain an extension with a smallish active userbase (~20k people) and a couple different times I've encountered mysterious failures that were the result of clumsy keyword blocklists in ublock/adblock/etc - for example an extension asset (pa…

Yes. We seem to have moved from a position of "four different browsers with differing behaviour" to "four consistent browsers with consistent behaviour, each with hundreds of potential content-rewriting extensions that may arbitrarily break your site in unexpected ways". I'm not convinced this is an improvement.

Well we also used to have mostly non-HTTPS, where wifi networks and ISPs could and did insert crap into pages. I much prefer now being able to guarantee that what the user downloads is what the site provided. At least then the "turn everything off and see if it works now" option should be viable.

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#26
post #23

An interesting related anecdote on this is that at least in Chrome, adblockers can also interfere with extensions' attempts to load scripts, load stylesheets, or open windows. I maintain an extension with a smallish active userbase (~20k people) and a couple different times I've encountered mysterious failures that were the result of clumsy keyword blocklists in ublock/adblock/etc - for example an extension asset (pa…

Using Little Snitch can be pretty eye-opening; I wouldn't for the life of me have imagined that my terminal installations of packages with stuff like Homebrew would send calls to Google Analytics. It's bloody everywhere.

That one is actually documented in their repository: https://github.com/Homebrew/brew/blob/master/docs/Analytics....

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#27
post #9
post #8

Earlier quoted context omitted.

Can you really blame them? Websites became hostile to users and users reacted. I don't know what your software is, and this certainly isn't directed at you, but if I'm forced to make a choice between using an ad blocker or using some software, I'll always choose the ad blocker (unless I was forced to use said software), especially if there are alternatives. There are no real alternatives to using an ad blocker.

Don't assume most people are polite and reasonable like you. Many people are arseholes. You're choosing to use either the ad-blocker, or the software, and you've chosen the ad-blocker. You can see how tiresome it would be to have a flood of rude people saying "your software sucks", when there's nothing wrong with the software. There's a problem with the ad-blocker that the user has. The bug report should go to that a…

> when the fix needed is only achievable by the ad-block creator.

It seems to me that there are two possible fixes. One, the ad-block creator updates their list, yes. But the other is the extension writer renames the file that is triggering the ad-blocker so the ad-blocker is no longer triggered.

The only one of those two fixes that is within the direct control of the extension writer is renaming the file within the extension that is triggering the ad-blocker.

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#28
post #7

Another protip: don't name your images "banner.jpg"; "ads.js" and "analytics.js" etc are also not exactly great names. Another protip: Always make sure that critical flows in the app won't fail if analytics event fails. You probably want to wrap calls to analytics provider with your own function, and in that function check for existence of global analytics object like "window.ga" which may fail to load due to adblock…

IMHO it'd be much better to just mock it than to litter your code with if() all over the place, similar to how polyfills do it (but without the actual functionality):

    if (!window.ga) {
      window.ga = function(){};
    }

Re: A JavaScript browser library fails due to an adblocker blacklisting 'beacon.js'

#30
post #7

Another protip: don't name your images "banner.jpg"; "ads.js" and "analytics.js" etc are also not exactly great names. Another protip: Always make sure that critical flows in the app won't fail if analytics event fails. You probably want to wrap calls to analytics provider with your own function, and in that function check for existence of global analytics object like "window.ga" which may fail to load due to adblock…

This shit drives me up a goddamn wall.

I had a web app a few years ago that I was using webpack to build the JS with, and the output filename was just a SHA hash of the contents.

After an update, I started getting reports that it wasn't working for some people. Turns out they had adblockers that were blocking *ad.js and it just so happened that the SHA hash of the file ended in ad.js

Post reply on HN