0

I tried to block Facebook on Chrome by changing the hosts file but to no avail. What could possibly went wrong?

  1. Modifying hosts file does not have any effect

I followed exactly what the op did and rebooted, but I could still have access to Facebook.

doesn't work I have root access

  • 1
    Your hosts file is completely broken. There should be no space after any dot in a hostname. Remember: It's facebook.com not facebook. com. The latter one assigns only facebook. to another IP. Any errors in the hosts file is silently ignored and that's it. – GiantTree Apr 20 '16 at 12:51
  • I'm guessing whatever keyboard you are using assumes the periods to be line ends and adds the space for you during the construction of these lines. Investigate how to turn that off while composing this file. – wbogacz Apr 20 '16 at 12:56
  • @GiantTree If you look at the second screenshot, that appears to have spaces too, in a place you wouldn't expect any. I suspect it's an awful font rather than spaces actually in the file. – Dan Hulme Apr 20 '16 at 12:57
  • As a plus to what @GiantTree said, I'll point out that lines 3 and 4 do nothing. – Grimoire Apr 20 '16 at 12:57
  • @DeathMaskSalesman depends on the local network. If one host has the hostname facebook (that's possible) then it's blocked as well. It's just not needed because there won't be a host with that hostname. – GiantTree Apr 20 '16 at 13:00
  • @GiantTree Well, that's what I meant. The system tries to redirect the full URL to the IP on the left, so, technically, it couldn't understand a website name devoid of its domain. – Grimoire Apr 20 '16 at 13:04
  • Wow. Thank you all so much with such a quick response! There is no space between facebook.com Yes, it's just the font problem. Also, I was trying to add more lines like line 3 and 4to see whether it would work. –  Apr 20 '16 at 13:04
  • Whenever I type facebook.com on chrome, it would redirect me to m.facebook.com. –  Apr 20 '16 at 13:07
  • @GiantTree I just used another device ( Nexus 7 2013 4.4.4 rooted) to test: cleared chrome data. Add the line m.facebook.com (no space between.and com). Rebooted. Still doesn't work. Very frustrating... any help is much appreciated:) –  Apr 20 '16 at 13:57
  • Can you try with a different browser, possibly with no history of facebook being opened there? – Firelord Apr 20 '16 at 14:03
  • @Firelord I just did. I cleared all data on the stock browser and dolphins browser. I rebooted and tried to access Facebook on them. I still can. But thanks for the suggestion though:) –  Apr 20 '16 at 14:11

1 Answers1

0

Just try adding these three hosts name and replace ip address 127.0.0.1

    facebook.com  
    www.facebook.com  
    m.facebook.com
    mobile.facebook.com

As I checked when typed facebook.com, the site will be redirected to m.facebook.com, so we won't be able to access.

vusan
  • 123
  • 7