Block only selected scripts

Ask for help about NoScript, no registration needed to post
RodTrevizan

Block only selected scripts

Post 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
Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-BR; rv:1.9.2) Gecko/20100115 Firefox/3.6
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Block only selected scripts

Post by Giorgio Maone »

Use a page-level surrogate script with this replacement code:

Code: Select all

alert = history.back = function() {}
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
dhouwn
Bug Buster
Posts: 968
Joined: Thu Mar 19, 2009 12:51 pm

Re: Block only selected scripts

Post 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.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6
Guest

Re: Block only selected scripts

Post 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
Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-BR; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Guest

Re: Block only selected scripts

Post by Guest »

Nevermind, surrogate worked
I just forgot one "@" in the source thing
Thanks everyone
Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-BR; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Guest

Re: Block only selected scripts

Post by Guest »

Any way to block a specific alet window? =D
Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-BR; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
dhouwn
Bug Buster
Posts: 968
Joined: Thu Mar 19, 2009 12:51 pm

Re: Block only selected scripts

Post by dhouwn »

Rewrite the script on the page…
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.317.2 Safari/532.9
Post Reply