I was looking for a universal solution for detecting Adblocking not only for Chrome addons but also to detect Firefox private blocking. The only solution that I found was from this website.
I know that this has already been discussed here but that was a long time ago and some scripts are not working anymore or do not work in firefox private browsing.
I have managed to snip a code from the website mentioned above but problem is that I do not fully understand it so was wondering if you guys could help me out.
<script type="text/javascript">
$(window).load(function() {
null==document.getElementsByTagName("iframe").item(ga.length-1)&&$("div.login:last").html("<div>message to display if adblock or private browsing is detected</div>")
}
);
</script>
I know it is a jQuery and know that is utilising googles "iframe" but the next element, which is ".item(ga.length-1)", I dont understand. Only other thing with "ga" element is from google analytics but Im not sure if its related as javascript and jquery is not something Im completely familiar with.
The other element which is "$("div.login:last").html" I`m suspecting it is calling where to show the message which is in the last div class="login" which is in the ads section on their website.
Any solution that coveres both adblocks and private browsing will be most welcome. Thanks in advance.