Vertical Forest

Blocking Facebook Ads

Friday, February 22nd, 2008

Updated: Now blocks the social ads which show up in the news feed as well.

Updated x2: Updated for the new Facebook, and now blocks the sponsor ads on the homepage as well.

Updated x3: Blocks new sponsor ads in the sidebar.

I just received a request from a friend on Facebook to join a group petitioning that the stupid x-rated ads it shows be removed. Nice as it would be if Facebook would do this, realistically, I highly doubt they ever will. Fortunately, that doesn’t mean you still have to look at them.

A few months ago I became so fed up with these ads, that I wrote some CSS rules that will work in any browser to block these ads. If you don’t know what CSS is, don’t worry, it doesn’t matter, just follow the steps below and the Facebook ads will be banished forever.

Note: These steps are only necessary if you are using a browser other than Firefox. If you are using Firefox, simply install Adblock Plus and you’re done. For those using Internet Explorer or Safari, read on.

  1. Open a new text file in Notepad, Texmate, or a similar program and past the following line into it:

    #ssponsor, .footer_ad, .banner_ad, .social_ad, .ad_capsule, .sidebar_ads, .adcolumn, .admarket_ad, .sidebar_item.sponsor, .emu_sponsor, .home_sponsor, .UIHomeBox_Sponsored { display: none !important; }

  2. Save the file to your user directory or My Documents folder, and call it ‘usercontent.css’.

    Note: If you are using TextEdit on a Mac, you will need to go to the Format menu and click “Make Plain Text” before you save the file. Otherwise, you will not be able to save it as a .css file.

  3. Depending on what browser you are using, this step will vary.

For Internet Explorer users:
Go to Tools->Internet Options, the click on Accessibility down at the bottom right. Then under User Stylesheet check the box ‘Format documents using my stylesheet’, and then click browse. Locate and select the ‘usercontent.css’ file you saved earlier. Hit Open, then Ok, and Ok again, and you’re done. Once you reload Facebook, the ads should be gone.

parallels-desktopscreensnapz002.png

For Safari users:
Go to Safari->Preferences->Advanced, and select ‘Other’ from the Stylesheet dropdown near the bottom. Browse to where you saved the ‘usercontent.css’ file, select it, click Choose, and you’re done. Once you reload Facebook, the ads should be gone.

safariscreensnapz001.png

Enjoy an ad-less Facebook!

78 Responses »

  1. Wow Connor, I didn’t know you could use a custom CSS file. That’s awesome!

  2. I love CSS…

  3. Thanks so much!! I would never have been able to do that on my own. It is greatly appreciated!

  4. Wow! If I had a facebook, I would thank you profusely. Nerdiness is a wonderful thing, no? An attribute, really….

  5. Oh WOW! Thank you SO much! I just got a Facebook and haven’t been on it much because of the ads. Yuck….

  6. Worked like a charm. Thank you!

  7. YES!! Perfect! Thank you! It even hides the links below the ads that Firefox Adblock Plus didn’t!

  8. I can’t get this to work on my MAC in safari, I followed the instructions, but it won’t let me save as a css in notepad. Help?

  9. Thank you so much! those facebook ads have been plaguing me for some time now! God bless you!! ;)

  10. THANK YOU!!!

  11. Bless YOU!! it works and is soo easy, even for those nearly computer illiterate! :)

  12. I can’t seem to save a .css file on my mac. Can you help me out with that? Thanks!

  13. To save a .css file on a Mac using textedit, go to the Format menu and click “Make Plain Text”, then when you try to save the file simply name it ‘usercontent.css’.

  14. Thank you so much! It’s working!

  15. Thank you for helping get this off of my profile.

  16. For firefox users, copy the usercontent.css file into this folder:

    C:Documents and SettingsApplication DataMozillaFirefoxProfilesxxxxxxx.defaultchrome

  17. For those of you using mac and Firefox. Save this file as userConent.css (note the case it matters here…) You must save it in the chrome directory for your default profile. This should be under your home directory “~/Library/Application Support/Firefox/Profiles/q0s48ouu.default/chrome”. Simply save your userContent.css file here and restart Firefox and you should be all good.

  18. Great Job! i had actually emailed facebook on those ads but didn’t expect much.

  19. This is just what I have been looking for! I was ready to stop using Facebook because of the ever-increasing number of ads.

  20. Thank you for this! It was easy to do, and it really worked. I am passing it along to all of my friends!

  21. You’ve made my facebook experience much more awesome now! For the person or people who made those steps keep up the good work and thank you soooo much for giving me a way to clean up that disgusting garbage I have no control over and have to put up with everyday.

  22. Well it worked.. thanks. I was wondering- could this be done to a juno account as well?

    Thanks for the info.

  23. That is totally awesome!!! Now I just wish it would work on other sites like myspace and hotmail…….thank you so much for giving us some control! thank you again.

  24. Thanks! Worked Great. Big Help!

  25. Is there any way to block the “Sponsor” ads on the “Home” page?

  26. S VE, this could most likely be done to juno, but as I don’t have an account with them someone else would need to write the bock rules.

    Mike, I’ve updated it to block the sponsor ads as well as those on the new facebook.

  27. Connor thank you so much. I am going to share this with my friends. Does it work on MSN?

  28. This works for ads, but not sponsor ads. Any suggestion? I use IE7.

  29. This has been working great for me for a while now. I love the uncluttered, clean look it gives to Facebook. So thanks for that guys.

    One problem – within the past week or so the ‘Sponsor Ads’ in the grey box on the right hand side of the news feed page have started to reappear. I know absolutely nothing of stylesheets or CSS so i have no clue why! I’m assuming Facebook have changed something. So if you guys have any ideas of how to alter the stylesheet to combat this i would appreciate it.

    Cheers, Nick

  30. I have now updated it to block the sponsor ads in the sidebar of the homepage once again.

  31. Fantastic Connor. Working great. Thanks a lot!

  32. Trying…wasn’t sure if I should, but am glad I did!!!! Thanks so much! I was ready to bag FB, but now with it being nasty-ad-free it will be good way to continue networking.

  33. What about Google Chrome. How do I install the AdBlock for a Google Chrome browser???

  34. As far as I can tell, this is unfortunately not possible with Google Chrome as there is no way to specify a user stylesheet. Hopefully this will be remedied in future versions, but for the moment I’d recommend using another browser if you want to use Facebook without ads.

  35. Thanks loads for this. I’ve been trying loads of adblockers to get rid of these nasty facebook ads but none worked up til now. Together we will beat the scum known as advertising, if only we could beat spam as well :p

  36. WORKS GREAT! Can Earthlink WebMail adds be removed with this?

  37. This is awesome. Many of my friends have it and I think it is great. I use Google Chrome. Is there any way to do that with the chrome browser. I looked around but I am just not that good at these kind of things.

  38. Is there any way to use this CSS style to block other parts of facebook, more specifically the “Friends You May Know”, “Invite Your Friends” and “Find Your Friends” boxes on sidebar of facebook’s homepage? They add unnecessary clutter I think.

  39. Brilliant. Just brilliant. THANKS!!!

  40. [...] But a friend decided I’d be happier if I learned How To Block ALL Facebook Ads. [...]

  41. Thomas, it should be possible to hide other parts of Facebook this way, but I personally have no interest in doing so, so I’m afraid you’ll have to figure it out on your own.

    Shawn, they most likely could be, but I don’t personally use Earthlink so I haven’t written rules for it.

  42. A tip to individuals seeking ad-blocking features in Google Chrome, it’s worth your while to install Privoxy (see privoxy.org) and filter your web browser traffic through it.

    Facebook was doing well for awhile, as far as keeping ads somewhat relevant. But in the recent economic times, scammers are attempting to take advantage of people in tough positions.

  43. I use Adblock, not Adblock Plus. No matter what I do, I can’t remove the text ads along the right side. Will this css option work with Firefox and Adblock or is Plus my only option?

  44. Fantastic. Thanks so much.

  45. The ads are back! I successfully followed your instructions and used your CSS rules for a couple of months, and then as of tonight they are back! Any idea what FB has changed? Any chance of getting updated CSS rules, if that would help?

  46. Jeff, this method will work with Firefox as Bill and Phil detail above, it is simply more difficult to setup a usercontent.css file with Firefox than with Safari or IE. If you follow their instructions however, you should be able to get it working.

    CM, I just checked facebook, and the rules still appear to block the ads fine for me. You might want to make sure that everything is still set up properly on your computer.

  47. Hi again Connor.

    Seems like Facebook have changed up again. There’s now a ’suggestions’ box with friend and groups suggestions but also annoying ads turning up on certain pages. It’s not on the newsfeed pages but seems to be on profiles and apps pages. Is there any way you could work your magic again and banish it?

    Cheers, Nick

  48. hi connor!

    thanks a lot!! great magic – no ads on facebook any more!

    cheers rene

  49. Thanks… Worked perfectly.

  50. @CM: Are you sure you didn’t change the location of your .css file?

  51. Update the usercontent.css file.

    Add `.profile_sidebar_ads`

    you can copy and paste below lines:

    #ssponsor, .profile_sidebar_ads, .footer_ad, .banner_ad, .social_ad, .ad_capsule, .sidebar_ads, .adcolumn, .admarket_ad, .sidebar_item.sponsor, .emu_sponsor, .home_sponsor { display: none !important; }

  52. Well, today is a new day, and I too am once more seeing the dreaded facebook ads on the right side (when viewing profile).

  53. It worked for a few weeks but in the last day or so, the ads have returned. Thanks for the temp fix though. It was nice to have a break from their crap ads.

  54. Sooo like how would this work on Google Chrome?

  55. [...] the majority of the procedure, see the post Blocking Facebook Ads. The only thing that will differ in blocking the corners is to add this line to the userContent.css [...]

  56. They’re baaaack! Oh well, it was nice while it lasted.

  57. Updated for the new facebook… again:

    ssponsor,

    .footerad, .bannerad, .socialad, .adcapsule, .sidebarads, .adcolumn, .admarketad, .sidebaritem.sponsor, .emusponsor, .homesponsor, div.UIHomeBoxSponsored { display: none !important; }

  58. This was so easy and it worked! Thanks for putting this up for the IE users.

  59. Can’t get it to work. :(

  60. ok, for the CSS .. what will the ENTIRE thing look like now? Would it be a combination of the first blog post AND the addition of the May 9th entry or would it be ONLY the May 9th entry? And would the Feb 27 profile sidebar ad entry need to be tossed in for good measure? Example of a combo thing:

    ssponsor, .footerad, .bannerad, .socialad, .adcapsule, .sidebarads, .adcolumn, .admarketad, .sidebaritem.sponsor, .emusponsor, .homesponsor, .UIHomeBoxSponsored, .footerad, .bannerad, .socialad, .adcapsule, .sidebarads, .adcolumn, .admarketad, .sidebaritem.sponsor, .emusponsor, .homesponsor, div.UIHomeBoxSponsored, .profilesidebarads { display: none !important; }

  61. I continue to update the original post, so only what you see up at the top is necessary, at least as far as I can tell. In particular, I wouldn’t add the .profile_sidebar_ads, as this will mess up the alignment of your entire profile and move the main content column over to the right.

  62. Thank you sooo much. It worked on IE 8. I was having problems with typing on Facebook and FB is so slow on the new Firefox 3.5 that I now resort to IE 8 for Facebook. Now, I can just get rid of the highlights section on Facebook. But, may just learn to live with it. Thank you for sharing your wonderful knowledge and making it so simple for folks like me that are somewhat CSS illiterant. Lol. Thanks again and much joy.

  63. PS correction above post…now IF I can only get RID of the highlights section on FB.

  64. [...] Special thanks to Vertical Forest for writing the script and instructions.  Blocking Facebook Ads [...]

  65. My son complained about ads on FaceBook that his teenagers used … great solution

  66. thanks!! that was really helpful!! greatly speed up the loading speed!!

  67. please help, how would i block ALL public ads on facebook? i have windows. everytime i log onto facebook homepage there would always be an ad on the left hand side of the homepage and the bottom too. the ads are always either on the left or bottom whenever I’m on facebook in my profile, viewing friends, looking at my photos, etc. please help…. oh and i did tried what you mentioned about the copying and interent options…

  68. Wow that was easy! Thanks so much.

  69. I have bumped this a bit more. I hate the suggestions and events and other rubbish. So….

    ssponsor, .footerad, .bannerad, .socialad, .adcapsule, .sidebarads, .adcolumn, .admarketad, .sidebaritem.sponsor, .emusponsor, .homesponsor, .UITitleh5, .friendgridrow, .UIUpcomingItem, .UIUpcoming, .UISuggestionListItemContainer, .sxiconsinvite, .sxiconsfriendfinder, .UIHomeBoxMore, .pageleteventbox, .pageletconnectbox,.UIHomeBox_Sponsored { display: none !important; }

    Does it for me.

  70. FANTASTIC!!! FANX A MILLION :D

  71. THANK YOU!!! :)

  72. Thank you so much. Works brilliantly & so simple to do.

  73. This is brilliant! Thanks so much.

  74. Many (many) thanks. I didn’t mind until they were invasively over-targeted. “29 year old men with one foot slightly larger than the other, a pet rabbit, and poor taste in sweaters? We have free iPads for you!”

  75. Awesome guy, works flawlessly on my Mac using Safari -thanks so much for sharing! I posted on Twitter, also. :o )

  76. Very nice. Thank you!

  77. Wow. That is perfect! So simple! Other fools are going about using InPrivate filtering and crap, and it doesn’t work! This works perfectly. Well done! Thank you.

  78. not working

Leave a Reply

Comments will be styled using Markdown.