zengun

weblog

20021105

hide Flash banner ads in Mozilla

So you restlessly clicked on ‘Block images from this server’ until no more banner ads would show up, but never found a way to get rid of these annoying Flash banner ads?

CSS2 selectors to the rescue!
Just copy the following rules in your userContent.css file (you’ll find it in your profile’s chrome/ directory), and say goodbye to Flash advertising.

/* this hides the usual 468x60 Flash banner ads */
embed[type=”application/x-shockwave-flash”][width=”468″][height=”60″] {
  display: none !important;
  visibility: hidden !important;
}
/* this hides the not so usual but very annoying 728×90 Flash banner ads */
embed[type=”application/x-shockwave-flash”][width=”728″][height=”90″] {
  display: none !important;
  visibility: hidden !important;
}

You can easily extend these rules to cope with other banner sizes by copying a rule and changing the width and size attributes.
This was in response to this thread on Mozillazine forums.


12 responses

  1. […] log PHP, XML, CSS and general web development Skip to Navigation 6th November Michel: How to hide Flash banner ads in Mozilla using a few lines of CSS added to the userContent.css file […]

    #1 Simon Willison: Archive for 6th November 20022002/11/05 at 20:14

  2. […] tidakada helps you to hide Flash banner ads in Mozilla using CSS. […]

    #2 Axis Thoreau ::Die publicist die!2002/11/06 at 6:09

  3. Flash this
    Kill Flash ads in Mozilla with a little userContent.css

    #3 phil ringnalda dot com2002/11/06 at 7:46

  4. Hide Flash banner ads in Mozilla
    Michel Valdrighi: “So you restlessly clicked on ‘Block images from this server’ until no more banner ads would show up,

    #4 Too Much News2002/11/06 at 8:50

  5. I’ve done a similar thing, but only for images. Instead of hiding them, I set their transparency to some high value - apart from being a neat effect, it also preserves page layout.

    http://archivist.incutio.com/css-discuss/?id=13557

    #5 Jan!2002/11/06 at 10:16

  6. Slashdot post inspired by this entry:

    http://ask.slashdot.org/comments.pl?sid=44367&cid=4614903

    And Jan, I use the same low-opacity rule as you, along with full-opacity on :hover. Too bad the opacity property doesn’t work on Flash animations.

    #6 Micah2002/11/08 at 0:36

  7. Weniger Banner für Profis
    Hide Flash banner ads in Mozilla

    #7 RoyalTS - without cheese2002/11/08 at 19:55

  8. I just figured out how to block based on string in the URL (e.g. a banner directory). The CSS script looks like:

    img[src*=”banner”] {
    display: none !important;
    visibility: hidden !important;
    }

    #8 wik2002/11/16 at 0:52

  9. What we really need is a way to stop the flash animations that leap between me and the page I am trying to read. Until there’s a good way to block those, I am refraining from installing the flash plugin.

    #9 vbenares — 2002/12/12 at 5:25

  10. Help me out here with this thought:

    Make Mozilla think the MIME type of .SWF files is an image, then “Block Images from this Server” should work…

    #10 Me — 2003/01/13 at 14:34

  11. Ad blocking in Mozilla
    Mozilla offers a way to hide ads on web pages. It’s not as easy as blocking pop-ups but if you

    #11 Padawan.info2003/02/04 at 9:11

  12. Blocking flash ads in mozilla
    Just copy the following rules in your userContent.css file (you’ll find it in your profile’s chrome/ directory), and say goodbye to Flash advertising.

    /* this hides the usual 468×60 Flash banner ads */
    embed[type=”application/x-shockwave-flash…

    #12 Paper-Bags.org2003/05/26 at 20:09

Your words


Required fields:
Are marked by this sign: *
XHTML:
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
On comment spam/irrelevance:
Your comment may be moderated or considered as spam by the leprechauns running this server. If you get a 412 error or a mean message, it may be that they thought it was spam: try wording the comment differently or remind me to put up a contact form so you can warn me about the problem.
Of course, once the leprechauns are done doing their magic, I reserve the right to delete any comment for any reason.