First Understand how ad blockers work..
When a browser requests a website address it downloads the corresponding HTML file which includes internal & external references to Javascript files, CSS stylesheets and images. If the browser has an ad blocker installed, it will compare the names of referenced scripts & files against a "block list" and if there are any matches those files will be ignored.
To fix this problem, here i am providing a small solution.
Create one "ads.js" file on th root and place the below code in that file.
var canAdsRunOnThisSite = true;
The following code add in between Head tags (<head>...</head>).
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type = "text/javascript"> </script>
<script>
$(window).load(function () {
if (window.canAdsRunOnThisSite === undefined) {
$("#notify").show();
$('#top').animate({
'height': $(window).height(),
'position': 'fixed'
});
$('#adblocktext').fadeIn('1000');
$('#alt').click(function () {
$('#top').animate({
'height': '50px',
});
$('#adblocktext').fadeOut('1000');
});
}
});
</script>
In the Body content, at last add the following code. The below code i have added in this website.
<div id="notify" style="display:none;">
<p id="adblocktext"> <br />
I have detected that you are using AdBlock software. <br />
This site is supported by advertisements to keep site free for everyone. <br />
<span>Please add <a href="http://www.himasagar.com/">www.himasagar.com</a> to your
<br />
ad blocking whitelist or disable your adblocking software.</span> <br />
<span id="sig">- Himasagar Kutikuppala </span> <br /><br />
<span id="alt">Click here to close it. </span> <br />
</p>
</div>