WmZilla - Webmaster and Marketplace

The Next Generation Webmaster and Trade Forum

How to politely warn visitors using AdBlock

jaypanda

New member

0

0%

Status

Offline

Posts

35

Likes

0

Rep

0

Bits

185

3

Months of Service

0%
Hello friends, today while browsing websites, I noticed that even the largest websites in Turkey are now detecting ad blockers and giving warnings to please disable them. In my research online, I found a nice piece of code that works. This code is not mine; I embedded it yesterday without affecting the site's performance in any way. The original message was a bit stronger, and I softened it slightly. Here is the code:

```css
.swal2-container {
z-index: 10000;
}

function adblockMessage() {
swal({
title: 'Adblock Detected!',
text: "To support a blog's continued operation and to prevent the efforts from going to waste, please disable your ad blocker and refresh the page!",
type: 'error',
showCancelButton: false,
allowOutsideClick: false,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Refresh'
}).then((result) => {
if (result.value) {
location.reload();
}
})
}
```
 

249

6,622

6,642

Top