Re: How to Block/Allow Javascript?

Fabian Keil <[email protected]>
Newsgroups gmane.comp.web.privoxy.user
Message-ID <[email protected]>
"H. Hodges" <[email protected]> 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

_______________________________________________
Privoxy-users mailing list
[email protected]
https://lists.privoxy.org/mailman/listinfo/privoxy-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEETzbBfzgWkTZUoehQaRgikYuiNxwFAlv9YcwACgkQaRgikYui
NxxVWxAAkCOCGjaz341Rv76sJtb1KCytbJpY9JRYXRoMiI/OcSqNHBftFJtshFTk
m8e7sEC4kaNO35u44Or9I795fE61RjYQm+dk4UEFQBF79I1R6XgkBNzIXJipnmXk
hAInAsLse6a4bkM4XrofahjjCktkTAZIfiExJayHYj5KORI7AtPM4cxAOPLLW53y
ZHX/F3zuKnVCciM79CQnTerrtvquuBou/O5OFYA5sNRQPM3Ttw34WnysfEOjnk+T
HdDLy5dKP3tF9Ji1vjn10wv2ISiVIurF7ILpFpcSe/8gs7w+9PcMWXUiqFO/eiBY
YzqeFW3m7GvAIIHb4i//X9G0yI8z3pmPQqoVkkvfgrPSD5QZniqqQ86q4YPA0GzC
ruYRdk9nwK3RyipmOgEsp1I/GU0urzODN48E3oeXjV0Tg8qFF9qYh8SJ44Ckb05r
SgVdaCUV1lVcajfdsQUFauS3+8tLhZEAkwRtkxlylWSn0IdMtMoVQzizauaBJU0j
Vw+/NrKrkgwp5klbnSEBBvBWJO1s1OxEVzm2Tym+4nlG8s3pc/w2cPHP6yjwTTgf
LlabqDxYAcb2Om1sBb3QnHMVVfmhKE9nZZfM7P/UflREAZThszXX1EZhDbGW2+K0
zE1t6ew+QjImxuWpMTSh8UNikDdF5mF8UT8LWADb/XHBfAWxn50=
=aVk4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.