News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Adblock detector

Started by movierchives, February 26, 2016, 09:46:55 AM

Previous topic - Next topic

movierchives

Does one exist for SMF, which which advises people to switch it off for the domain?

Steve

Not in the searches I just did.
My pet rock is not feeling well. I think it's stoned.

dougiefresh

The mechanics of detecting whether AdBlock is blocking anything doesn't look hard from what I've seen on the BlockAdBlock github, which is forked from a different named item, which for the purposes of this discussion would get censored.... :P ::) O:) Writing a mod to do this would depend on what action you want to happen.

nend

You don't need JavaScript for this, you just need CSS.

The trick here is to make it look like a ad when it is not. I figured this out while looking in the DOM while trying to figure out how these blockers work.

You create a div with a class name of any of these.
.adsbnr
.adsbody
.adsborder
.adsboth
.adsbottom
.adsbottombox
.adsbox
.adsbox-square
.adsboxBtn
.adsbox_300x250
.adsboxitem
.adsbttmpg
.adsbygoogle
.adsbygoogle-box
.adsbygoogle2
.adsbysinodia
.adsbyyahoo
.adsc
.adscaleAdvert
.adscaleP6_canvas


If you want to display a message then I would suggest hiding a error div behind of the div with this class. So when the ad blocker is off the div would be covering it up, when it is on then the error would show.

I have this setup on my site if you want to take a look.

dougiefresh


vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: