• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » Wordpress » Easy Way Install Anti Adblock Plugin for Wordpress and Blogger

Easy Way Install Anti Adblock Plugin for WordPress and Blogger

By Sigit Prasetya Nugroho ∙ October 19, 2015 ∙ Wordpress ∙ 3 Comments

Share : TwitterFacebookTelegramWhatsapp

Seegatesite will share an article about how to install anti adblock plugin or adblock killer on wordpress site. Using the anti adblock plugin is form of rejection from adblock addon on browsers that reduce advertising revenues from website, where the ads used as lives a website. I get the anti adblock script from various reliable sources, and can function well for WordPress site.

I personally use adblock plus addon, although I didn’t support any ad-blocking activity. I use adblock because too many sites use the annoying ads such as pop-up ads, animated ads that heavy burden the CPU and spend our internet bandwidth.

Many of bloggers who began to fret with the existence of adblock plus, many people ask me, “How do I install anti adblock plugin ? “, “What is the best anti adblock adsense? ” And some even ask “How to create anti adblock script for bloggers? “. Frankly, I myself never use anti adblock script for my site. An outline, the purpose of adblock killer plugin can be good or bad for your site. Using anti adblock plugin can reduce your visitors.

Easy Way Install Anti Adblock Plugin For WordPress And Blogger

Table of Contents

  • 1 How Does Anti Adblock Plugin Work
    • 1.1 How to create anti adblock plugin for wordpress
    • 1.2 Thus article is about Easy Way Install Anti Adblock Plugin for WordPress, hope useful 🙂

How Does Anti Adblock Plugin Work

Anti Adblock plugin created with javascript where the js detect the existence of adblock plus addon the browser. Anti adblock plugin has the following functions

– Users install / activate the Adblock extension in the browser
– Users Enable Javascript on the site
– Users install / activate Anti Adblock extension Killer in browser

How to create anti adblock plugin for wordpress

Previously I thank to http://www.arlinadzgn.com/ who share how to create anti adblock script for blogger. From this source i try to implement anti adblock code to wordpress site in some methods.

#1. Installation Anti Adblock script from wordpress’s widget and blogger’s widget

1. Copy this code below to your widget menu

How To Install Anti Adblock Script To Widget Menu WordPress

How To Install Anti Adblock Jquery To Widget Menu WordPress

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<style type='text/css'>
    #h237 {
        position: fixed !important;
        position: absolute;
        top: 0;
        top: expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop: document.body.scrollTop)+"px");
        left: 0;
        width: 102%;
        height: 102%;
        background-color: #000000;
        opacity: .99;
        display: block;
        padding: 7% 0;
        bottom: 0;
        right: 0;
        z-index: 9999!important;
    }
    
    #h237 * {
        text-align: center;
        margin: 0 auto;
        display: block;
        font: bold 14px Verdana, Arial, sans-serif;
        text-decoration: none
    }
    
    #h237 * a {
        padding: 12px 15px!important;
        background-color: #f77c6a;
        color: #fff!important;
        font-weight: 700;
        font-size: 14px;
        font-family: 'Open Sans', sans-serif;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 3px;
        display: block;
        margin: 15px auto;
        clear: both;
        width: 20%;
        transition: all 0.3s ease-out;
    }
    
    #h237 * a:hover {
        opacity: .9;
    }
    
    #h237 ~ * {
        display: none
    }
</style>
 
 
 
 
 
 
<div id="h237">
    <span>Please enable javascript!</span></div>
 
 
 
<script>
    window.document.getElementById("h237").parentNode.removeChild(window.document.getElementById("h237"));
    (function(l, m) {
        function n(a) {
            a && h237.nextFunction()
        }
        var h = l.document,
            p = ["i", "s", "u"];
        n.prototype = {
            rand: function(a) {
                return Math.floor(Math.random() * a)
            },
            getElementBy: function(a, b) {
                return a ? h.getElementById(a) : h.getElementsByTagName(b)
            },
            getStyle: function(a) {
                var b = h.defaultView;
                return b && b.getComputedStyle ? b.getComputedStyle(a, null) : a.currentStyle
            },
            deferExecution: function(a) {
                setTimeout(a, 250)
            },
            insert: function(a, b) {
                var e = h.createElement("span"),
                    d = h.body,
                    c = d.childNodes.length,
                    g = d.style,
                    f = 0,
                    k = 0;
                if ("h237" == b) {
                    e.setAttribute("id", b);
                    g.margin = g.padding = 0;
                    g.height = "100%";
                    for (c = this.rand(c); f < c; f++) 1 == d.childNodes[f].nodeType && (k = Math.max(k, parseFloat(this.getStyle(d.childNodes[f]).zIndex) || 0));
                    k && (e.style.zIndex = k + 1);
                    c++
                }
                e.innerHTML = a;
                d.insertBefore(e, d.childNodes[c - 1])
            },
            displayMessage: function(a) {
                var b = this;
                a = "abisuq".charAt(b.rand(5));
                b.insert("<" + a + '>
 
 
<h3 style="color:#ffffff">Please disable ad-blocker to view this page</h3>
 
 
 
<a href="JavaScript:window.location.reload()">Reload</a>' + ("</" + a + ">"), "h237");
                h.addEventListener && b.deferExecution(function() {
                    b.getElementBy("h237").addEventListener("DOMNodeRemoved", function() {
                        b.displayMessage()
                    }, !1)
                })
            },
            i: function() {
                for (var a = "DivTopAd,ad-zone-1,ad_190x90,ads-sticky,iqadtile5,leftframeAD,tobsideAd,ad,ads,adsense".split(","), b = a.length, e = "", d = this, c = 0, g = "abisuq".charAt(d.rand(5)); c < b; c++) d.getElementBy(a[c]) || (e += "<" + g + ' id="' + a[c] + '"></' + g + ">");
                d.insert(e);
                d.deferExecution(function() {
                    for (c = 0; c < b; c++)
                        if (null == d.getElementBy(a[c]).offsetParent || "none" == d.getStyle(d.getElementBy(a[c])).display) return d.displayMessage("#" + a[c] + "(" + c + ")");
                    d.nextFunction()
                })
            },
            s: function() {
                var a = {
                        'pagead2.googlesyndic': 'google_ad_client',
                        'js.adscale.de/getads': 'adscale_slot_id',
                        'get.mirando.de/miran': 'adPlaceId'
                    },
                    b = this,
                    e = b.getElementBy(0, "script"),
                    d = e.length - 1,
                    c, g, f, k;
                h.write = null;
                for (h.writeln = null; 0 <= d; --d)
                    if (c = e[d].src.substr(7, 20), a[c] !== m) {
                        f = h.createElement("script");
                        f.type = "text/javascript";
                        f.src = e[d].src;
                        g = a[c];
                        l[g] = m;
                        f.onload = f.onreadystatechange = function() {
                            k = this;
                            l[g] !== m || k.readyState && "loaded" !== k.readyState && "complete" !== k.readyState || (l[g] = f.onload = f.onreadystatechange = null, e[0].parentNode.removeChild(f))
                        };
                        e[0].parentNode.insertBefore(f, e[0]);
                        b.deferExecution(function() {
                            if (l[g] === m) return b.displayMessage(f.src);
                            b.nextFunction()
                        });
                        return
                    }
                b.nextFunction()
            },
            u: function() {
                var a = "ad&adv_keywords=,-page-peel/,/adchain.,/adfootright.,/adsxml/ad,/adyard300.,/impopup/ad,/loadadsparam.,/meme_ad.,_adshare.".split(","),
                    b = this,
                    e = b.getElementBy(0, "img"),
                    d, c;
                e[0] !== m && e[0].src !== m && (d = new Image, d.onload = function() {
                    c = this;
                    c.onload = null;
                    c.onerror = function() {
                        p = null;
                        b.displayMessage(c.src)
                    };
                    c.src = e[0].src + "#" + a.join("")
                }, d.src = e[0].src);
                b.deferExecution(function() {
                    b.nextFunction()
                })
            },
            nextFunction: function() {
                var a = p[0];
                a !== m && (p.shift(), this[a]())
            }
        };
        l.h237 = h237 = new n;
        h.addEventListener ? l.addEventListener("load", n, !1) : l.attachEvent("onload", n)
    })(window);
</script>

2. Save and refresh your browser to see the result

#2. Create Anti Adblock plugin wordpress

1. Create a new folder on your plugin directory as sgt_anti_adblock
2. Create new php file as sgt_anti_adblock.php and copy this code below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* Plugin Name: Anti adblock shield
* Plugin URI: https://seegatesite.com
* Description: This plugin allow you block the content when users use adblock or anti adblock killer on browser
* Version: 1.0.0
* Author: Sigit Prasetya Nugroho
* Author URI: https://seegatesite.com
* License: GPL2
*/
 
function sgt_anti_adblock_plugin() {
    echo '
 
 
<div id="h237">
    <span>Please enable javascript!</span></div>
 
 
 
';
}
add_action( 'wp_footer', 'sgt_anti_adblock_plugin' );
 
function sgt_anti_adblock_script() {
wp_register_style( 'sgt_anti_adblock_css', plugins_url('sgt_anti_adblock.css', __FILE__),array() );
wp_enqueue_style( 'sgt_anti_adblock_css' );
 
wp_register_script( 'sgt_anti_adblock_js', plugins_url('sgt_anti_adblock.js',__FILE__ ),array(),'1.0.0', true );
wp_enqueue_script('sgt_anti_adblock_js');
}
 
add_action( 'wp_enqueue_scripts', 'sgt_anti_adblock_script' );

2. Create new javascript file as sgt_anti_adblock.js and copy this script below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
    window.document.getElementById("h237").parentNode.removeChild(window.document.getElementById("h237"));
    (function(l, m) {
        function n(a) {
            a && h237.nextFunction()
        }
        var h = l.document,
            p = ["i", "s", "u"];
        n.prototype = {
            rand: function(a) {
                return Math.floor(Math.random() * a)
            },
            getElementBy: function(a, b) {
                return a ? h.getElementById(a) : h.getElementsByTagName(b)
            },
            getStyle: function(a) {
                var b = h.defaultView;
                return b && b.getComputedStyle ? b.getComputedStyle(a, null) : a.currentStyle
            },
            deferExecution: function(a) {
                setTimeout(a, 250)
            },
            insert: function(a, b) {
                var e = h.createElement("span"),
                    d = h.body,
                    c = d.childNodes.length,
                    g = d.style,
                    f = 0,
                    k = 0;
                if ("h237" == b) {
                    e.setAttribute("id", b);
                    g.margin = g.padding = 0;
                    g.height = "100%";
                    for (c = this.rand(c); f < c; f++) 1 == d.childNodes[f].nodeType && (k = Math.max(k, parseFloat(this.getStyle(d.childNodes[f]).zIndex) || 0));
                    k && (e.style.zIndex = k + 1);
                    c++
                }
                e.innerHTML = a;
                d.insertBefore(e, d.childNodes[c - 1])
            },
            displayMessage: function(a) {
                var b = this;
                a = "abisuq".charAt(b.rand(5));
                b.insert("<" + a + '>
 
 
<h3 style="color:#ffffff">Please disable ad-blocker to view this page</h3>
 
 
 
<a href="JavaScript:window.location.reload()">Reload</a>' + ("</" + a + ">"), "h237");
                h.addEventListener && b.deferExecution(function() {
                    b.getElementBy("h237").addEventListener("DOMNodeRemoved", function() {
                        b.displayMessage()
                    }, !1)
                })
            },
            i: function() {
                for (var a = "DivTopAd,ad-zone-1,ad_190x90,ads-sticky,iqadtile5,leftframeAD,tobsideAd,ad,ads,adsense".split(","), b = a.length, e = "", d = this, c = 0, g = "abisuq".charAt(d.rand(5)); c < b; c++) d.getElementBy(a[c]) || (e += "<" + g + ' id="' + a[c] + '"></' + g + ">");
                d.insert(e);
                d.deferExecution(function() {
                    for (c = 0; c < b; c++)
                        if (null == d.getElementBy(a[c]).offsetParent || "none" == d.getStyle(d.getElementBy(a[c])).display) return d.displayMessage("#" + a[c] + "(" + c + ")");
                    d.nextFunction()
                })
            },
            s: function() {
                var a = {
                        'pagead2.googlesyndic': 'google_ad_client',
                        'js.adscale.de/getads': 'adscale_slot_id',
                        'get.mirando.de/miran': 'adPlaceId'
                    },
                    b = this,
                    e = b.getElementBy(0, "script"),
                    d = e.length - 1,
                    c, g, f, k;
                h.write = null;
                for (h.writeln = null; 0 <= d; --d)
                    if (c = e[d].src.substr(7, 20), a[c] !== m) {
                        f = h.createElement("script");
                        f.type = "text/javascript";
                        f.src = e[d].src;
                        g = a[c];
                        l[g] = m;
                        f.onload = f.onreadystatechange = function() {
                            k = this;
                            l[g] !== m || k.readyState && "loaded" !== k.readyState && "complete" !== k.readyState || (l[g] = f.onload = f.onreadystatechange = null, e[0].parentNode.removeChild(f))
                        };
                        e[0].parentNode.insertBefore(f, e[0]);
                        b.deferExecution(function() {
                            if (l[g] === m) return b.displayMessage(f.src);
                            b.nextFunction()
                        });
                        return
                    }
                b.nextFunction()
            },
            u: function() {
                var a = "ad&adv_keywords=,-page-peel/,/adchain.,/adfootright.,/adsxml/ad,/adyard300.,/impopup/ad,/loadadsparam.,/meme_ad.,_adshare.".split(","),
                    b = this,
                    e = b.getElementBy(0, "img"),
                    d, c;
                e[0] !== m && e[0].src !== m && (d = new Image, d.onload = function() {
                    c = this;
                    c.onload = null;
                    c.onerror = function() {
                        p = null;
                        b.displayMessage(c.src)
                    };
                    c.src = e[0].src + "#" + a.join("")
                }, d.src = e[0].src);
                b.deferExecution(function() {
                    b.nextFunction()
                })
            },
            nextFunction: function() {
                var a = p[0];
                a !== m && (p.shift(), this[a]())
            }
        };
        l.h237 = h237 = new n;
        h.addEventListener ? l.addEventListener("load", n, !1) : l.attachEvent("onload", n)
    })(window);

3. Create new css file as sgt_anti_adblock.css and copy this css script below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#h237 {
        position: fixed !important;
        position: absolute;
        top: 0;
        top: expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop: document.body.scrollTop)+"px");
        left: 0;
        width: 102%;
        height: 102%;
        background-color: #000000;
        opacity: .99;
        display: block;
        padding: 7% 0;
        bottom: 0;
        right: 0;
        z-index: 9999!important;
    }
    
    #h237 * {
        text-align: center;
        margin: 0 auto;
        display: block;
        font: bold 14px Verdana, Arial, sans-serif;
        text-decoration: none
    }
    
    #h237 * a {
        padding: 12px 15px!important;
        background-color: #f77c6a;
        color: #fff!important;
        font-weight: 700;
        font-size: 14px;
        font-family: 'Open Sans', sans-serif;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 3px;
        display: block;
        margin: 15px auto;
        clear: both;
        width: 20%;
        transition: all 0.3s ease-out;
    }
    
    #h237 * a:hover {
        opacity: .9;
    }
    
    #h237 ~ * {
        display: none
    }

4. Active the sgt_anti_adblock plugin from plugin menu wordpress.

Voila, your anti adblock plugin is already to used. The anti adblock full script can be downloaded below

[sociallocker id=”58″]Sgt Anti Adblock[/sociallocker]

Conclusion : Anti adblock plugin not the best solution to fight adblock extension, create content that is good and useful to others then they will reply to you

Thus article is about Easy Way Install Anti Adblock Plugin for WordPress, hope useful 🙂

Another WordPress Related Post :

  • How To Create The Fastest Social Share Button WordPress Without Plugin
  • Create WordPress Slider Without Javascript
  • The Point Responsive WordPress Theme For Blogging
  • The Doctors Free WordPress Responsive Theme For Medical
  • Develop Your Site With Start Blogging The Responsive WordPress Theme
  • Zerius Theme The Free WordPress Responsive Theme

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Comments

  1. Avatar for BarinderBarinder says

    June 17, 2017 at 6:15 am

    This Script is for WordPress , but i want for blogger, & most of the scripts are working only on pc , so what to do for phone adblockers

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      June 17, 2017 at 9:26 am

      i will update if i have these script 🙂

      Reply
  2. Avatar for AdamAdam says

    September 11, 2019 at 2:56 pm

    thats cool thanks but im not using wordperess is the code can be used on other web builders?

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      September 14, 2019 at 8:52 am

      you can customize the code

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Welcome to my Home,

Avatar for Sigit Prasetya NugrohoThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) lumen api (4) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (8) Publisher Tips (5) react (6) Reactjs (9) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2022 Seegatesite.com