this post was submitted on 25 Oct 2023
1955 points (99.0% liked)

me_irl

5241 readers
1 users here now

Selfies for the soul.

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] ShittyKopper@lemmy.blahaj.zone 3 points 1 year ago* (last edited 1 year ago)

You can try to load an image from a subdomain like ads., or from a filename like 468x80.png (see EasyList) to catch all the common ad blockers, maybe with an id of Ad-Container to catch css-based ad blockers.

DNS based blockers that use regular expressions or wildcards will work with the subdomain approach, but most of them still rely on hardcoded list of domains which means you either need to get a throwaway (sub)domain on their lists OR serve data from an actual ad server (or just live with the occasional false positives from people who believe DNS blocking is enough [which it really isn't if we're being honest])

But honestly, in this case doing it with JS should be fine since disabling JS is a quite effective ad blocker anyway. Here's how I do it for example: https://ads.d.on-t.work/ad.min.js (and you can try it out at https://w.on-t.work)