[Privoxy-users] Privoxy-users Digest, Vol 25, Issue 2
Lee
ler762 at gmail.com
Sat Dec 15 21:27:10 UTC 2018
On 12/15/18, H. Hodges <h.hodges at gmx.com> wrote:
> What makes filters and blocks unreliable for blocking Javascript?
https - all privoxy sees is the host name, so blocking javascript is
not possible (without blocking the whole site).
For https:// sites all you can do is block or allow based on the host
part of the URL (eg: www.example.com) Privoxy can't tell if the
browser is going for www.example.com/page.html or
www.example.com/script.js. All it knows is the browser is asking for
an encrypted connection to www.example.com
If you're using http the traffic is 'in the clear' and privoxy can
filter, block, whatever.
> Can you add something to the documentation that actually explains how
> to construct filters?
Take a look at https://www.privoxy.org/user-manual/filter-file.html
> You've listed an example filter here and there
> are examples in the Privoxy documentation, but it's difficult to figure
> out the actual structure of filters from examples alone. When you say
> "use a filter like," that tells me nothing because I'm not sure what
> the individual parts of your example do, so I don't know which parts of
> it to use in my own filter. I can refresh my knowledge of regular
> expressions by myself, but it would be nice to know what to apply the
> regular expressions to.
The regular expressions are applied to the page source for filters
(eg. user.filter) & URLs for blocks (eg. user.action). That isn't
clear from the docs?
Regards,
Lee
>
> On Wed, Nov 28, 2018 at 4:00 AM,
> privoxy-users-request at lists.privoxy.org wrote:
>> Send Privoxy-users mailing list submissions to
>> privoxy-users at lists.privoxy.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://lists.privoxy.org/mailman/listinfo/privoxy-users
>> or, via email, send a message with subject or body 'help' to
>> privoxy-users-request at lists.privoxy.org
>>
>> You can reach the person managing the list at
>> privoxy-users-owner at lists.privoxy.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Privoxy-users digest..."
>>
>>
>> Today's Topics:
>>
>> 1. How to Block/Allow Javascript? (H. Hodges)
>> 2. Re: How to Block/Allow Javascript? (Fabian Keil)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 12 Nov 2018 14:12:02 -0800
>> From: "H. Hodges" <h.hodges at gmx.com>
>> To: privoxy-users at lists.privoxy.org
>> Subject: [Privoxy-users] How to Block/Allow Javascript?
>> Message-ID: <1542060722.2.0 at smtp.gmx.com>
>> Content-Type: text/plain; charset=utf-8; format=flowed
>>
>> I want to block Javascript by default and whitelist some scripts. I
>> assume that I need to use filters, but I don't know how to refer to
>> Javascript in the rules (for example, *.js or ^script).
>>
>> Thanks for any help.
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Tue, 27 Nov 2018 16:25:00 +0100
>> From: Fabian Keil <fk at fabiankeil.de>
>> To: "H. Hodges" <h.hodges at gmx.com>, privoxy-users at lists.privoxy.org
>> Subject: Re: [Privoxy-users] How to Block/Allow Javascript?
>> Message-ID: <20181127162500.3156cc2b at fabiankeil.de>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> "H. Hodges" <h.hodges at gmx.com> wrote:
>>
>>> I want to block Javascript by default and whitelist some scripts. I
>>> assume that I need to use filters, but I don't know how to refer to
>>> Javascript in the rules (for example, *.js or ^script).
>>
>> You can use both a filter and blocks, however this will
>> not work 100% reliable.
>>
>> To remove script regions you can use a filter like:
>>
>> FILTER: remove-scripts Remove script tags
>> s@<script[^>]*>.*</script>@@Ugis
>>
>> Additionally you can block URLs ending with js:
>>
>> {+block{JavaScript is disabled}}
>> /.*\.js
>>
>> Some sites embed JavaScript in other tags using event attributes:
>> https://en.wikipedia.org/wiki/HTML_attribute#Event_attributes
>>
>> Preventing this requires additional filter rules.
>>
>> Fabian
More information about the Privoxy-users
mailing list