Hacker News new | ask | show | jobs
by shimfish 4489 days ago
I drove myself insane for a morning recently when I couldn't work out why a site of mine that had happily been working for years suddenly stopped displaying some images in the carousel. They were there in the HTML but Chrome reckoned they were zero size. Eventually, it hit me that I should try turning off adblock. Turns out, I had called the imgs containg divs "#ad1", "#ad2". "#ad3", etc were all fine for some reason.

Anyway, the point is that you could probably easily check for adblock by checking the image size of something within a div named "advert".

2 comments

And you described the main reason why people who say ad blockers "protect users" are wrong. They just hide the ads, they don't block them. Better to just send to localhost all known ad network domains. There are some noce precompiled lists around the web for that exact purpose.
I once had to use a method like this to detect adblock to specificially deny a somewhat intrusive ad from being displayed, as adblock screwed it up enough that it wouldn't close.