Page 1 of 1

Block only selected scripts

Posted: Thu Feb 04, 2010 11:23 am
by RodTrevizan
What can I do to block only two scripts in a page?
<SCRIPT LANGUAGE=JavaScript>self.alert('Bla-bla-bla.');self.history.back();</SCRIPT>
They would be:
self.alert and self.history.back

Or where can I find the source code of noscript and edit it :)
Thanks

Re: Block only selected scripts

Posted: Thu Feb 04, 2010 11:45 am
by Giorgio Maone
Use a page-level surrogate script with this replacement code:

Code: Select all

alert = history.back = function() {}

Re: Block only selected scripts

Posted: Fri Feb 05, 2010 2:17 am
by dhouwn
Alternatively you could use config policies in this case:
http://www.mozilla.org/projects/securit ... olicy.html

Code: Select all

capability.policy.policynames

Code: Select all

constrained

Code: Select all

capability.policy.constrained.sites

Code: Select all

http://www.example.org

Code: Select all

capability.policy.constrained.Window.alert

Code: Select all

noAccess

Code: Select all

capability.policy.constrained.Window.history.back

Code: Select all

noAccess
Not tested though.

Re: Block only selected scripts

Posted: Sat Feb 06, 2010 10:36 am
by Guest
dhouwn wrote:Alternatively you could use config policies in this case:
http://www.mozilla.org/projects/securit ... olicy.html

Code: Select all

capability.policy.policynames

Code: Select all

constrained

Code: Select all

capability.policy.constrained.sites

Code: Select all

http://www.example.org

Code: Select all

capability.policy.constrained.Window.alert

Code: Select all

noAccess

Code: Select all

capability.policy.constrained.Window.history.back

Code: Select all

noAccess
Not tested though.
Went to about:config created a new string and everything, but when I try to search for this string I created it's like is not there, I want to try it manually but can't find user.js :/
Tried the surrogate thing either and still doesn't work

Re: Block only selected scripts

Posted: Sat Feb 06, 2010 10:54 am
by Guest
Nevermind, surrogate worked
I just forgot one "@" in the source thing
Thanks everyone

Re: Block only selected scripts

Posted: Sat Feb 06, 2010 11:08 am
by Guest
Any way to block a specific alet window? =D

Re: Block only selected scripts

Posted: Mon Feb 08, 2010 6:56 am
by dhouwn
Rewrite the script on the page…