Discussions » Creation Requests

Anyone think this is the best way to block "Anti-AdBlock" ?

§
Posted: 2014-11-30

Anyone think this is the best way to block "Anti-AdBlock" ?

1. We all know that Anti-AdBlock can easily kill all our work just by a few lines of code like this:
- They detect element exist by if element.display == "none" then kill us.
- They detect element width/height by if element.width == ??? then kill us.
- They detect element length by (i think) this way if element.toString.length then kill us

2. And they kill us by:
- document.write to change whole HTML
- innerHTML and outerHTML to change page
- Every DHTML method like appendChild, createElement.. to write something make us unreadable or kill the whole page with a block.

So here come the solution, I think the best way is block them from 1st but at this time I only have idea, my Javascript skill at this time cannot write something like that:
1. They all use if + something else to detect us, right ? And if we can detect when they call if and all parameter of that if's call then probably we can block that call, because I know that Javascript can by override if we learn really deep about it, example override alert. confirm, prompt, createElement that is all over the internet, but override "if", I never make that work but I think it is possible, if someone here figure how to do.

2. 2nd step is easier, override createElement, document.write, appendChild is really easy and possible using "Proxy parttern" something like this:

var proxied = document.write; // Preserving original function
document.write = function(evt) {
if evt = something then do something, clearly we can block at this step.
return proxied.apply(this, arguments);
}

I tried and work, but innerHTML and outerHTML, anyone know how to override it to detect its parameter, if it is done then clearly I can write more to detect .length, .width, .height... and maybe better than 1st solution.

Many thank! Hope someone can help me and we all celebrate with our result!


But they all use "if"

§
Posted: 2014-11-30

Small update, my 2nd method variable evt is not necessary because I found a way to use this[0], arguments[0] instead:

var proxied = document.write; // Preserving original function
document.write = function() {
if arguments[0] = something then do something, clearly we can block at this step.
return proxied.apply(this, arguments);
}

Post reply

Sign in to post a reply.