floppymoose.com | home | projects | about | blog |
Tired of distracting ad images cluttering up your web experience, or
even your email?
Here is a simple way to keep many of these ads from displaying in your
browser.
The technique below works for any Gecko-based browser (Mozilla,
Firefox, Camino,
Netscape7). It also works
for Apple's browser: Safari. See
the special instructions for Safari below.
And it even works with the Thunderbird
mail client! See Thunderbird directions
below. Also, check out the new notes on dealing
with Flash advertising, below. Finally, I've improved the ad
blocking based on user feedback. Already using it? Grab the
latest for even better results.
chrome
directory of your browser user profile. The different browsers
store your profile in slightly different places. For macos X, the
profile chrome directory locations are:
home:Library:Application
Support:Firefox:
Profiles:
profilename:randomstring.default:
chrome:
home:Library:Mozilla:
Profiles:profilename:randomstring.slt:
chrome:
home:Library:Application
Support:Camino:
chrome:
Restart your browser to pick up the styles. Go to your
favorite
sites and see that many ad images are gone, but other images are still
there!
userContent.css
somewhere convenient (I suggest home:Library:Safari
) and
then launch Safari.
Go to the Preferences...
menu
item, and choose the Advanced
tab. Use the
stylesheet popup to choose the new userContent.css
file. There is no need to restart Safari - it will immediately
apply the stylesheet to all pages.
chrome
directory of your Thunderbird user profile. For macos X,
the profile
chrome directory locations is:home:Library:Application
Support:Thunderbird:
Profiles:
profilename:randomstring.default:chrome:
Why should you use a custom user stylesheet with
Thunderbird? For the same reason you should use it with your
browser: to block unwanted ads! Many mail providers can place ads
in your email. Using this stylesheet you can block almost all of
them.userContent.css
file, your
browser will no
longer show certain ad images and ad iframes. If you have no idea
what
I'm talking about, no worries. Simply install the userContent.css
file
and give it a try. Many ads in web pages will no longer be there!userContent.css
work. One of the CSS rules in the file has a set
of
selectors that look like
A:link[HREF*="ad."] IMG
and a rule that looks like {
display: none ! important }
. This selector is CSS's
way of saying Find all the images
that are wrapped in links, where the link takes me to a url that has
"ad." somewhere in it. The rule is CSS-speak for Don't display that image. userContent.css
full time. I have carefully designed my CSS
selectors to catch ads but not other content. However, sometimes
I still encounter a blocked image that should not have been
blocked. To fix these I can do two things.
First, I can find which ad selector matched the blocked content, and
try to refine it in a way that still catches all the ads it had been
catching, but no longer catches the blocked content. If I cannot
find a way to do that, I simply ad a new selector to the rule at the
very bottom of the userContent.css
file. That rule
is {
display: inline ! important }
, which is CSS-speak for display this normally. The
selectors you see with this rule are all urls that
correspond to false positives I found. For example, the use of
the selector
A:link[HREF*="netflix.com/AddToQueue."] IMG
fixed the
problem of invisible buttons on Netflix's order form.userContent.css
.userContent.css
do not block
Flash animations that are ads. To do that there are a couple of
things you can try. The first is the simplest and works with any
web browser: find the Flash library on your computer and delete
it! This will eliminate all Flash animations in your web
browser. If you are like me and don't care much about sites that
using Flash for things other than advertising, this solution should
work well for you. /* Prevent flash animations from
playing until you click on them.
*/
object[classid$=":D27CDB6E-AE6D-11cf-96B8-444553540000"],
object[codebase*="swflash.cab"],
object[type="application/x-shockwave-flash"],
embed[type="application/x-shockwave-flash"],
embed[src$=".swf"]
{ -moz-binding:
url("http://www.floppymoose.com/clickToView.xml#ctv"); }
userContent.css
. You
may also
redistribute it, with or without your own modifications. All I
ask is that you leave a comment in the userContent.css
file indicating
that is from, or derived from, the ad blocking css found at
www.floppymoose.com.