Blocking JS with Privoxy

General discussion and chat (archived)

Moderator: satrow

User avatar
Mesh Malachi
Newbie
Newbie
Posts: 4
Joined: 2018-09-01, 03:51

Blocking JS with Privoxy

Unread post by Mesh Malachi » 2018-11-12, 21:17

How can I block Javascript with Privoxy? I'm pretty sure I need to use a filter, but +filter{*.js} and +filter{*javascript*} didn't work.

I'm trying to block JS by default and then whitelist scripts. I don't want to use add-ons.

Edit: +filter{whatever} is just the filter label; I see now that I have to define the filtering rule separately (using regular expressions) from the label. My problem is that I'm not sure what the rule should be. The *.js and *javascript* were guesses about the rule.
Last edited by Mesh Malachi on 2018-11-12, 21:29, edited 2 times in total.

User avatar
Mesh Malachi
Newbie
Newbie
Posts: 4
Joined: 2018-09-01, 03:51

Re: Blocking JS with Privoxy

Unread post by Mesh Malachi » 2018-11-12, 22:07

Just found their mailing list, so I guess that's where I'll get my answer.

User avatar
Fedor2
Astronaut
Astronaut
Posts: 660
Joined: 2016-04-11, 01:26

Re: Blocking JS with Privoxy

Unread post by Fedor2 » 2018-11-14, 17:05

When i want to save clean html page

in the filter file:

Code: Select all

FILTER: clean-of-script Remove all script tag
s-<script.*</script>--sigU
s-</?(noscript).*>--sigU
then in the action file:
{ +filter{clean-of-script} }
/

User avatar
nateliv
New to the forum
New to the forum
Posts: 1
Joined: 2018-12-18, 08:48

Re: Blocking JS with Privoxy

Unread post by nateliv » 2018-12-18, 08:49

To add an additional site to the block list easily, first open the user.action file.
Code:
$ sudo gedit /etc/privoxy/user.action
You're going to make a backup, aren't you! Yes, good idea! Do that! Give yourself a pat on the back.
Read the readme.
Scroll to the very bottom of the file
Add

Code:
{+block}
.xyxlol.com
to the bottom of the file.
In future, you can add others like so

Code:
{+block}
.xyxlol.com
.anotherannoyingsite.net
.so-many-adverts-argh.org

Locked