I've seen the code before somewhere else but I can't find it. I would like to find a way of notifying users via the Notification bar to add an exception for a website.
Asked
Active
Viewed 1,379 times
-3
-
http://stackoverflow.com/a/20505898/1357033 - Good answer. – Mansoorkhan Cherupuzha Aug 20 '15 at 10:11
6 Answers
1
I don't have the code off-hand but the basic strategy to do this is to attempt to execute code that ad-block pro normally blocks and then check if it ran successfully or not. If not, you can display a notification to the user.

Jeremy Battle
- 1,638
- 13
- 18
1
You could try this...
var image = new Image();
image.onerror = function() {
alert('C\'mon, the ads pay for this site :(');
}
image.src = 'http://example.com/known-url-adblock-blocks';
..or...

alex
- 479,566
- 201
- 878
- 984
0
An alternate way of doing this really simply is checking your ad containers height. You can then detect in almost one line of jQuery!
function checkAds()
{
if($(".ad-container").height()=="0")
{
// Show notification here!
}
}

jduncanator
- 2,154
- 1
- 22
- 39
0
My easiest solution with jquery is:
$.ajax({
url: "/Scripts/custom/advertisement.js", // this is just an empty js file
dataType: "script",
success: function () {
// user doesn't use adblock
}
})
.fail(function () {
// user uses adblock
});
advertisement.js just contains nothing.

Luca Steeb
- 1,795
- 4
- 23
- 44
0
You could throw a javascript alert up based on any of the methods found on Stackoverflow already: