[Privoxy-users] How to Block/Allow Javascript?

Fabian Keil fk at fabiankeil.de
Tue Nov 27 15:25:00 UTC 2018


"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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.privoxy.org/pipermail/privoxy-users/attachments/20181127/7d600b40/attachment.bin>


More information about the Privoxy-users mailing list