Page 1 of 1

Disallowing specific JavaScript functions

Posted: Tue Dec 28, 2010 2:36 am
by wwj
Hey there!

I use NoScript and I like it a lot. It would be great if it allowed blocking selected JavaScript functions, because some pose a serious threat to privacy (such as those reading your screen resolution) by fingerprinting. How about that?

Thanks!
wwj

Re: Disallowing specific JavaScript functions

Posted: Tue Dec 28, 2010 8:14 am
by Giorgio Maone
You can use script surrogates for this purpose.
E.g., to always return random screen resolution values,

Code: Select all

["screenWidth", "screenHeight"].forEach(function(p) { window.__defineGetter__(p, function() { return Math.round(800 * Math.random()) + 800 }) })

Re: Disallowing specific JavaScript functions

Posted: Tue Dec 28, 2010 8:30 pm
by wwj
Wow, that is great, thanks! But still, I think it'd be nice to have an easy-to-use interface that would make doing this simple. :-)

Re: Disallowing specific JavaScript functions

Posted: Fri Dec 31, 2010 4:19 pm
by tlu
You might want to try Controle de Scripts. Its comprehensive help site can be found here.

Re: Disallowing specific JavaScript functions

Posted: Mon Jan 17, 2011 1:30 am
by wwj
That's all great, thanks a lot guys, but I guess the best defense against fingerprinting would be the same NoScript assumes -- whitelisting by default, so one'd have to block all JS, and then enable specific functions, and unfortunately neither provide this ability. :-( Do you have any other ideas?

Thanks!
wwj