R
R
RuLab2012-09-27 12:46:49
JavaScript
RuLab, 2012-09-27 12:46:49

How to block the execution of a crooked plugin for Google Chrome?

I ran into a problem, the www.complitly.com/ plugin in chrome constantly knocks on the server at site.com/undefined, which creates an extra load on the server.
How can the site (namely the site, not the server) block this plugin? I tried to redefine its functions in JS, but in vain ...

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikhail Davydov, 2012-09-27
@RuLab

You can hang a content-dependent hook on the String prototype function.
The plugin uses this construction somestring.replace(/^[^\?]+(\?)*/, '');for some of its purposes
. We can rewrite String.prototype.replaceand, depending on the arguments, throw an exception that is unexpected for it (thus interrupting the plugin at the very beginning).

(function (){
    var realStringPrototypeReplace = String.prototype.replace;
    
    String.prototype.replace = function (what) {
        if (what.toString() === "/^[^\\?]+(\\?)*/") {
            throw new TypeError();
        } else {
            return realStringPrototypeReplace.apply(this, arguments);
        }
    };
}());

The problem here is that the arguments are unique (so that something useful does not run into our trap) and most importantly, that this code starts before the plugin code, otherwise you will have to look for some similar dynamic place.

B
barker, 2012-09-27
@barker

Not a plugin, but an extension. And don't you think that the very idea that you can block a browser extension through a website is absurd? That's something users of some AdBlock would be constantly surprised.

P
pletinsky, 2012-09-27
@pletinsky

If we are talking about the fact that this plugin constantly goes to some URL, then this can be a normal solution for a search system with autocomplete, which this system is.
So what do you still want, I do not understand?
… which puts extra load on the server .
What other server is causing the load? Is the plugin constantly trying to access the server you own by url? I do not understand.
How can the site (namely the site, not the server) block this plugin?
What is the difference between a site and a server in your terminology?

N
nur, 2012-09-27
@nur

create an undefined file and send it through nginx, it will not take a lot of resources to return the void (as I understand you, the 404 handler starts, writes logs and eats kittens)
or something like this
location = /undefined { return 200; }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question