MyBB Community Forums

Full Version: How do I add an Ad Blocker notice and Ad Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was wondering is there a way I can add a Disable ad blockers notice and is there any Ad Plugin I use to display that message?
Add adblocker script
in header ..no plugin needed !
I want something like a Plugin once they disable the Ad Blockers and ads displays.
Usually how people do it is you have a div on your page that has the message about ads:

<div class="blocker-notice">Please turn off your ad blocker</div>

Then you'll have a file called ads.js which hides the message:

$('.blocker-notice').remove();

This works because if the user has an ad-blocker installed, it won't load ads.js so the message will stay on the page, and if they don't have an ad-blocker, it will load ads.js and hide the message.
(2018-12-10, 08:00 PM)Matt Wrote: [ -> ]Usually how people do it is you have a div on your page that has the message about ads:

<div class="blocker-notice">Please turn off your ad blocker</div>

Then you'll have a file called ads.js which hides the message:

$('.blocker-notice').remove();

This works because if the user has an ad-blocker installed, it won't load ads.js so the message will stay on the page, and if they don't have an ad-blocker, it will load ads.js and hide the message.

This is the best solution, I will like to suggest an enhancement to this answer.
Suppose a user has also disabled javascript then the above solution will not work.
You should also add a <noscript> tag so that if user has disabled javascript, then they will need to enable javascript first.
(2018-12-11, 03:50 AM)WallBB Wrote: [ -> ]
(2018-12-10, 08:00 PM)Matt Wrote: [ -> ]Usually how people do it is you have a div on your page that has the message about ads:

<div class="blocker-notice">Please turn off your ad blocker</div>

Then you'll have a file called ads.js which hides the message:

$('.blocker-notice').remove();

This works because if the user has an ad-blocker installed, it won't load ads.js so the message will stay on the page, and if they don't have an ad-blocker, it will load ads.js and hide the message.

This is the best solution, I will like to suggest an enhancement to this answer.
Suppose a user has also disabled javascript then the above solution will not work.
You should also add a <noscript> tag so that if user has disabled javascript, then they will need to enable javascript first.

Yes, that should be implemented as well.

I do have the AdBlocker app installed on my desktop and other devices. 

So, if I enter a website that tells me that in order for me to view a video or movie, I have to disable the AdBlocker. So, I do that...

I view the video or movie... once that is done, then I re-enable the AdBlocker app again and I go on my merry way.
thank you guys for your help!