Remove All Facebook Ads

By tidalwav1 Last update Jan 3, 2009 — Installed 347,634 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 15 posts, 14 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Calciphus Scriptwright

I updated the search query on my version to reflect new side ads on Facebook. Just add:

| //div[contains(@class, 'social_ad_advert')]

To the list at the IF statement

 
Daddy Scriptwright

Avg, those are really bad programming manners!
If I were XPathResult implementator, I would change the values of the constants once in a while just to get people like you screwed :P

 
Avindra V.G. Scriptwright

You can change

XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE

to

6

That's all it is; a constant.

 
Aud1073cH User

I suggest adding //div[contains(@class, 'sidebar_item sponsor')]
and possibly //div[contains(@class, 'emu_ad')]

These removed the new sidebar ads for me on the "new" Facebook.

 
Kid Twist Scriptwright

I recommend also including

//div[contains(@class, 'profile_sidebar_ads')]

to block the sidebar ads when viewing profiles.

 
donna duniski User

Hey i'm very new to this script business, and I'm a facebook user looking to get rid of the adds on my facebook. Where do I paste this script? How do I use a script? Thanks.

 
AaronCompNetSys User

Works great for me. I added a few more classes and IDs.
Line 11 in the script:
var elements = document.evaluate("//div[contains(@class, 'ad_capsule')] | //div[contains(@class, 'social_ad')] | //div[@id='announce'] | //div[contains(@id, 'sponsor')] | //div[contains(@id, 'ssponsor')] | //div[contains(@class, 'invite')] | //div[contains(@id, 'gift')] | //div[contains(@id, 'sponsor')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

 
Liza May User

This only works if I refresh each page. When I first load a page all the ads are there. Do I need to change the code somehow?

 
NATEive User

Lovely, thank you!

 
tidalwav1 Script's Author

Isaac, you're completely right.

I've updated the script to reflect this.

 
Isaac Levy Scriptwright

This is a great little script. Props.

FYI though, the if block is unnecessary. The for loop won't execute if the number of elements is 0, because 'i' won't be less than the number of elements even on the first iteration. So removing the if line (and bracket on the other side of the for loop) won't change the behavior of the code.

 
Kevin 1 User

This is awesome. Makes Facebook just a tiny bit less annoying and spam-like. Thanks!

 
tidalwav1 Script's Author

I just updated this script. News feed sponsored items are now no longer shown. (Facebook's code changed since this script's original release, making the script temporarily not work.) All is better now--please install the new version of this script--version 1.1.

 
muppet User

This works really well. Some of the older scripts don't work anymore, but this one removes the sponsored ads from your news feed.

Thanks!

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel