Disallowing specific JavaScript functions

Bug reports and enhancement requests
Post Reply
wwj
Posts: 6
Joined: Wed Dec 22, 2010 4:14 pm

Disallowing specific JavaScript functions

Post 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
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1) Gecko/20090703 Firefox/3.5
User avatar
Giorgio Maone
Site Admin
Posts: 9527
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Disallowing specific JavaScript functions

Post 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 }) })
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
wwj
Posts: 6
Joined: Wed Dec 22, 2010 4:14 pm

Re: Disallowing specific JavaScript functions

Post 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. :-)
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1) Gecko/20090703 Firefox/3.5
tlu
Senior Member
Posts: 129
Joined: Fri Jun 05, 2009 8:01 pm

Re: Disallowing specific JavaScript functions

Post by tlu »

You might want to try Controle de Scripts. Its comprehensive help site can be found here.
Mozilla/5.0 (X11; U; Linux x86_64; de-DE; rv:1.9.2.14pre) Gecko/20101231 Ubuntu/10.10 (maverick) Namoroka/3.6.14pre
wwj
Posts: 6
Joined: Wed Dec 22, 2010 4:14 pm

Re: Disallowing specific JavaScript functions

Post 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
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1) Gecko/20090703 Firefox/3.5
Post Reply