I got sick of blocking sites such as facebook.com and facebook.net per browser, and decided to add them to my /etc/hosts file so the sites would be blocked entirely: facebook.com facebook.net www.facebook.com

That seemed to do the trick, but now when I load pages that attempt to include Facebook "Like" buttons, I get a big gray box that says The server refused the connection. Seems like a pretty ugly way to handle such a thing, being that the gray box obscures more than 75% of the page sometimes.

Is there a way I can keep blocking requests but eliminate this usability destroyer that is the big gray box?

  • It looks like sometimes I'm able to dismiss the gray box by clicking on it, but that doesn't always work. – hourback Apr 11 '14 at 15:48
  • Actually, looking at the JavaScript snippet that tries to call Facebook, it looks like sometimes what happens is that the code tries to resize an element, and then eventually times out, halting the script and causing the gray box to disappear. – hourback Jun 4 '14 at 17:08
  • 1
    This is a clunky method, but you could set up a web server on your computer with a blank index.html as the home page and redirect traffic in your hosts file to – DaveTheMinion Dec 14 '15 at 21:12

You could just use an extension like ScriptSafe and enable the Antisocial option to completely block the scripts of anything social. You could also use a program like PeerBlock and add Facebook and its affiliated sites to the HTTP blocklist.

ScriptSafe will prevent Facebook's scripts from loading, which is the lion's share of their undesirable content, without breaking the pages you're viewing. It won't remove any non-script Facebook content, though. Using PeerBlock will stop ALL Facebook related traffic, but I have no guarantees about things being broken by it.

  • Unfortunately, I couldn't find a way for this to work well across browsers. Using a solution like this requires me to update settings for every browser, or at least treat Chrome differently, which is what I was hoping to avoid. – hourback Aug 5 '14 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.