4 >The Filter File</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64
10 TITLE="Privoxy User Manual"
11 HREF="index.html"><LINK
14 HREF="actions-file.html"><LINK
17 HREF="templates.html"><LINK
20 HREF="../p_doc.css"></HEAD
39 >Privoxy User Manual</TH
47 HREF="actions-file.html"
74 >9. The Filter File</A
77 > Any web page can be dynamically modified with the filter file. This
78 modification can be removal, or re-writing, of any web page content,
79 including tags and non-visible content. The default filter file is
83 >, located in the config
86 > This is potentially a very powerful feature, and requires knowledge of both
89 >"regular expression"</SPAN
90 > and HTML in order create custom
91 filters. But, there are a number of useful filters included with
95 > for many common situations.</P
97 > The included example file is divided into sections. Each section begins
101 > keyword, followed by the identifier
102 for that section, e.g. <SPAN
104 >"FILTER: webbugs"</SPAN
105 >. Each section performs
106 a similar type of filtering, such as <SPAN
108 >"html-annoyances"</SPAN
111 > This file uses regular expressions to alter or remove any string in the
112 target page. The expressions can only operate on one line at a time. Some
113 examples from the included default <TT
118 > Stop web pages from displaying annoying messages in the status bar by
119 deleting such references:</P
124 CLASS="LITERALLAYOUT"
125 > FILTER: html-annoyances<br>
127 # New browser windows should be resizeable and have a location and status<br>
128 # bar. Make it so.<br>
130 s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig<br>
131 s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig<br>
132 s/scrolling="?(no|0|Auto)"?/scrolling=1/ig<br>
133 s/menubar="?(no|0)"?/menubar=1/ig <br>
135 # The <BLINK> tag was a crime!<br>
137 s*<blink>|</blink>**ig<br>
139 # Is this evil? <br>
141 #s/framespacing="?(no|0)"?//ig<br>
142 #s/margin(height|width)=[0-9]*//gi<br>
143 </P
148 > Just for kicks, replace any occurrence of <SPAN
155 >, and have a little fun with topical buzzwords: </P
160 CLASS="LITERALLAYOUT"
161 > FILTER: fun<br>
163 s/microsoft(?!.com)/MicroSuck/ig<br>
165 # Buzzword Bingo:<br>
167 s/industry-leading|cutting-edge|award-winning/<font color=red><b>BINGO!</b></font>/ig<br>
168 </P
173 > Kill those pesky little web-bugs:</P
178 CLASS="LITERALLAYOUT"
179 > # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)<br>
180 FILTER: webbugs<br>
182 s/<img\s+[^>]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1(\D[^>]*?)?>/<!-- Squished WebBug -->/sig<br>
183 </P
199 > Filters are enabled with the <A
200 HREF="actions-file.html#FILTER"
207 one of the actions files. <SPAN
210 > requires one parameter, which
211 should match one of the section identifiers in the filter file itself. Example:</P
220 > +filter{html-annoyances}</PRE
225 > This would activate that particular filter. Similarly, <SPAN
229 can be turned off for selected sites as:
232 >"-filter{html-annoyances}"</SPAN
233 >. Remember too, all actions are off by
234 default, unless they are explicity enabled in one of the actions files.</P
252 HREF="actions-file.html"
268 HREF="templates.html"