Jump to content

Welcome to Scriptznulled #1 nulling site

Welcome to Scriptznulled #1 nulling site, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of Scriptznulled #1 nulling site by signing in or creating an account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get email updates
  • Get your own profile page and make new friends
  • Send personal messages to other members.
Sign in to follow this  

[XF2} Show adblock detected notice

Recommended Posts

Today i used an old resource of xF1 on xF2 by copying required things.

This Tutorial will help you to shows adblock notice to user in place of google advertisement banner.


In order to get it working on your website, first create java script file namely advertisement.js and add it to your forum root directory.

add following code to it - its just a one line code.

document.write('<div id="tester">an advertisement</div>');

Then go to extra.less template and add below code to its end.

/* AdBlock Detection */
#tester {

.blockContainer { text-align: center; margin: 10px auto; clear: both; }
.noticeContainer { padding: 20px; background: #c44; color: #fff; }
.noticeContainer .head { font-size: 22px; font-weight: bold; }
.noticeContainer .foot { font-size: 16px; margin-top: 10px; }

then go to advertisement section and select a ad where you want to show the message when ads are blocked - mostly the advertisement will be at ad below top breadcrumb or overview top or any location you want.

After you google adsense code in HTML area, add below lines of code in it.

<script type="text/javascript" src="/advertisement.js"></script>
        <script type="text/javascript">
            if (document.getElementById("tester") != undefined)
                    document.write(' ');
                    document.write('<div class="messageText ugc blockContainer"><div class="noticeContainer"><div class="head">Ad-blocking software has been detected!</div><div class="foot">This website is run by the community, for the community... and it needs advertisements in order to keep running.<br />Please consider disabling your ad-block or <a href="account/upgrades" style="color: #FFF933; font-weight:bold">becoming a premium member</a> to hide all advertisements. Thanks!</div></div></div>');

You can edit message to show, as per your wish and style.

That's it!, now you can test it for correct configuration by enabling ad block on your website.

If you get the message like as shown in above image, you did it correctly.

I made this by understanding code from below thread.


You can see it in action by clicking here



did corrections in tutorial

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use.