Block website on Windows without host file

7,398

Solution 1

Why don't you just change the permissions on the hosts file so that "Everyone" or "Authenticated Users" have modify? Then anyone can edit it. Though, I am confused as to why you would ever do this.

Solution 2

You could use Fiddler with the following bit of fiddlerscript. You can add them in Rules > Customize Rules… and put it under the OnBeforeRequest function:

if (oSession.HostnameIs("subdomain.example.com")){
    oSession.bypassGateway = true;
    oSession["x-overrideHost"] = "127.0.0.1";
}

This would cause your browser to search for a website on localhost rather than subdomain.example.com. This script simulates the Windows hosts file.

Solution 3

You can use "Block content" in Opera or AdBlock in FireFox.

Share:
7,398

Related videos on Youtube

Giorgi
Author by

Giorgi

Software Engineer Author of EntityFramework.Exceptions and LINQPad QueryPlan Visualizer Personal Blog & Portfolio

Updated on September 17, 2022

Comments

  • Giorgi
    Giorgi almost 2 years

    Is it possible to block website on Windows without modifying hosts files? The reason I do not want to use it is that users need administrator options to modify it.

    I need some easier way to block a website. Any ideas?

    • petersohn
      petersohn about 14 years
      So you want a way to block websites that users without administrator rights can configure?
    • Giorgi
      Giorgi about 14 years
      I want a user which does not have administrator rights to be able to block webpages for himself only.
    • Jeff Martin
      Jeff Martin about 14 years
      what is the purpose of a user blocking a webpage for himself, can't he just not go there?
    • nhinkle
      nhinkle about 14 years
      I'm not sure why you want to let users block things for themselves when they could just not visit the site, but if you just want to block it in the browser, check out firefox addons like leech block, or find something equivalent for your browser. That may serve the desired purpose.
  • Nathaniel
    Nathaniel about 14 years
    It would only block sites for your whole LAN if you specified it as the DNS server in your DHCP server (like your router). If you just set your computer to use it, only your computer will be affected.