Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinking badges!
June 26, 2006 9:49 PM   Subscribe

How do I get my browser to ignore a certain site?

Occasionally when I go to my yahoo mail, I'm prompted repeatedly, by popup, for a password for one of the sites serving ads.

It's happening again, at this page, returning each of these two popups six times:

I've added to my HOSTS file and restarted the computer, according to these instructions (i.e. I added a line saying and saved the file again, with no extension). I thought that would solve the problem but it hasn't; revisiting that page after reboot shows that the site is still pestering me for a password.

I want my browser to ignore any and all requests from that site--to dump it in the bit bucket and continue loading the page without its input. I thought that was what HOSTS was for; but if it is, then why isn't it working?
posted by Tuwa to Computers & Internet (15 answers total)
I added a line saying and saved the file again, with no extension

There is no (easy) way to stop the browser requests completely. What this does is redirect them to the computer the browser is running on (which always has the address or localhost), which in theory is meant to make them fail, since your own computer won't normally respond to HTTP requests.

What's happening instead is that software running at (ie on your own computer) is responding to the requests and telling the browser you don't have permission. You need to figure out which software of yours is doing this.

(Did this happen before you started monkeying with the HOSTS file?)
posted by cillit bang at 10:00 PM on June 26, 2006

Given that the image itself (at least the instance I just looked at) seems to be on, I'd try adding simply to your HOSTS file.
posted by pompomtom at 10:00 PM on June 26, 2006

You could try Adblock.
posted by oaf at 10:03 PM on June 26, 2006

No, pompomtom, the images are at and the images filenames are and

cillit bang, ah, I'm not sure. I had to install IIS last semester for a database project and ... I should have thought of that. Yes, there's a legitimate reason for my computer to be acting like a server. No, I couldn't tell you when exactly this started, though it was right around the time I installed IIS and so was probably caused by it.

[ponders a bit about "a little knowledge" and "dangerous things" ... goes off to various places to read up on HOSTS some more ... discovers a difference in behavior between and in HOSTS file ... goes off to change this instance of to and reboot]....
posted by Tuwa at 10:18 PM on June 26, 2006

ah, pompomtom, I misunderstood. I should get a doctorate in misunderstanding. Okay, I'll add that too.

posted by Tuwa at 10:19 PM on June 26, 2006

I should get a doctorate in misunderstanding.

They have those? Where do I queue?
posted by pompomtom at 10:38 PM on June 26, 2006

Thanks for your answers, everyone. Changing to did it.

oaf, thanks for the suggestion. I've been using Flashblock and that, combined with FF's image blocker, has been enough so far. And I guess that I've got HOSTS working it will probably still be enough.

cillit bang, if will cause a computer set up like a server to try to field the request, why is the default in that writeup rather than The article is written with the point of explaing how to block certain traffic, rather than simply misdirecting it. I just ask because I have the nagging feeling I'm still missing something.
posted by Tuwa at 10:41 PM on June 26, 2006

There were several ways of doing this besides the one you used, but to give better advice we would need to know which browser you were using, and which operating system you were using.

For instance, if you were using IE under XP, you could have blocked the IP for that site in the firewall, or you could have told IE itself that the site was "restricted" so that IE would never try to access it.

FireFox has a similar blocking function, but the details of setup are entirely different.

I'm not so sure that the change from to actually made any difference. What I suspect is that you didn't flush the browser cache, so the problem persisted until the browser decided the cache was stale and finally tried to reaccess the site -- and failed, because of the change to the HOSTS file.
posted by Steven C. Den Beste at 11:04 PM on June 26, 2006

I think the thing you're missing is that setting the hosts file to point to doesn't set up the machine up like a server. All the hosts file does is allow you to tell your computer what IP address you want a name to point to. Usually when you try to connect to a site by name, your computer does a DNS name lookup to find what IP address it has, and then it connects to that IP addess. The hosts file bypasses that, and lets you map a name to an IP address directly. If you put in there, then whenever you try to connect to, you will actually go to yahoo's IP address instead.

The address is a special IP address that all computers use to refer to themselves. So a simple way to block a site is to just map its name to you own computer. Then when your browser tries to connect to that site, it just connects to your own machine and gets no response, since you don't have a web server running to answer the connection request.

Your problem is that you do have a web server running to answer the request, and apparently one that has password protection turned on. I would bet that some ad-blocker you installed at some point had already put a entry for in your hosts file (and you may have more than one hosts file, do a search), which had been harmlessly trying to connect to your own machine, until you installed IIS. Then the connections were actually successful, nd you started seeing the password prompt, coming from IIS.

The reason everyone uses instead of is that most people don't have a web server running, so pointing to themselves will give the fastest connection failure. actually refers to the default network, which means you are now trying to connect to something outside of your machine. You're not going to get a valid http response, so it still works for your ad-block scenario, but it's not the Right Thing To Do, and could cause other weirdness. Turning off IIS would fix your issue. Or if you must leave it on, put in your hosts file instead of It's a reserved address that hardly anyone uses, so the connection should fail properly and quickly.
posted by team lowkey at 1:16 AM on June 27, 2006

This is one huge reason why this awful hack of using the 'hosts' file for something that it was not designed for is a bad idea. AdBlock can do everything the hosts file can and better. The 'hosts' file was never designed to be an ad blocker or poor man's firewall.
posted by Rhomboid at 6:00 AM on June 27, 2006

cillit bang, if will cause a computer set up like a server to try to field the request, why is the default in that writeup rather than

What team lowkey said. Your computer was already running as a server (because of IIS). Using in the hosts file redirects all requests to the local computer. Normally, this means they fail immediately because most computers aren't set up as servers and so refuse the request. Because of your IIS, this didn't work that way.
posted by cillit bang at 6:38 AM on June 27, 2006

team lowkey, I didn't mean that the hosts file made my computer act as a server; what I meant was that installing IIS did. I still need IIS because I still haven't finished the database project (it trounced me thoroughly; I passed anyway--don't ask me why--but I'm still working on it because I want to learn how to do the things I should have learned how to do).

Thanks for the explanation of why 127.0.01 is used, though: it fails faster. And thanks for the suggestion of what to use instead. It won't work in this case, though, because it eventually leads to (again, probably a result of IIS).

Rhomboid: so this is all a horrible hack? I have an actual firewall, too, but it's also a poor man's firewall--nothing very sophisticated or customizable.
posted by Tuwa at 7:03 AM on June 27, 2006 , not 127. It is actually a valid routable address, but one that is restricted to only be used on a local network, not on the internet at large. It's very unlikely you are using it on your local network, so it should fail quickly.
posted by team lowkey at 11:11 AM on June 27, 2006

Ah jeez. thanks for the correction, team lowkey. Yes, does fail (as you suggest it should). It doesn't fail quickly, though; unless ten seconds is "quickly" (that's how long it takes for Firefox to give up).

Now I'm off to look into Adblock and/or ways integral to Firefox to block traffic from certain sites. I hesitate to install additional extensions at this point just because Firefox already has a large footprint (probably because of something I've done... yesterday it got very very slow and system processes informed me that it was using 99% of my CPU and 300 MB of RAM, which is a good chunk of the 512 MB on this box). So I should probably look into ways to reduce the load that Firefox is putting on the computer, too.
posted by Tuwa at 12:20 PM on June 27, 2006

Using the 'hosts' file to block ads IS a terrible hack, because it doesn't actually block anything, it just substitutes one IP address (localhost) for another (the IP address of the server with the ad.) It does not stop the browser from making the request, it just redirects it -- in the case of localhost ( it redirects it to a known location where normally nothing is listening on port 80. But as you've seen in your case this is not always true, and if you do happen to have something listening on port 80 of localhost this fails spectacularly.

The real solution is to actually block the request, and this is what AdBlock does. This also gives you much more control over what is blocked, as you can specify hostnames and URLs to block using regular expressions. With the 'hosts' method you have no granularity whatsoever -- you cannot block based on URI (only hostname) and you must specify the hostname exactly, you cannot use any form of wildcard/glob/regexp.

Another common misconception that I have seen in people is thinking that by adding an entry in the 'hosts' file this will somehow block access to an address. This is absolutely not true. The only thing the 'hosts' file does is provide a way to override the normal process of DNS resolution. If an application uses accesses a resource directly by IP address, or it resolves the hostname without using the standard Windows DNS resolver API (e.g. it contains its own resolver code), then the entry in the 'hosts' file will have absolutley no effect at all. It is not a firewall!
posted by Rhomboid at 6:44 PM on June 27, 2006

« Older Most interesting true-life tales?   |   Why not learn about biophysics in Corsica? Newer »
This thread is closed to new comments.