Helping people with computers... one answer at a time.

You can block floating ads from websites with your hosts file, but you should first consider if that is really a good idea.


How can I stop floaters? The annoying ads everywhere! I read the code but fail to locate anything. Host file is useless; the pop-up blocker is just not that effective. What do I do?

In this excerpt from Answercast #89, I look at the way that many pop-up ads on websites work and why they are there.

Block floating ads

So I assume you're referring to the various ads that show up on the websites that you visit, (potentially even including Ask Leo! - I'll speak to that in a minute.)

The "floaters" (pop-up boxes that appear when you mouse over things) are actually not pop-ups. I know it doesn't make sense because they "pop up." But they are not pop-ups in the classic sense.

Popping ads aren't pop-ups

They are not separate windows. They are not separate controls or something that most pop-up blockers even notice and would be able to stop.

What they are is actually the page, the web page itself, dynamically changing itself so that its content now includes that box that has the ad in it.

Block with the hosts file

Normally those ads come from other sites. The host file is absolutely one way to block these things.

If you know the domain from which these ads are coming; if you know the domain from which typically the Javascript that implements these ads is coming from; you can redirect those domains to and have those ads be disabled.

The hard part is of course identifying just what domain you need to do that to - because it's rarely obvious.

Ads on the internet

Now, in the case of Ask Leo! I have these kind of floating ads on my site. Until recently, they've been a significant portion of the revenue that keeps Ask Leo! free.

I think it's important to understand that the advertising you see on sites like Ask Leo! and other sites are how those websites manage to keep their information free. When you end up blocking advertisements you're actually blocking that website's ability to pay for what it needs to pay for - and putting its actual existence at risk.

I know that just one person doing that doesn't impact that much. But of course, if many people end up doing that, the revenues for the site go down and the site becomes at risk of no longer being viable. I have to admit that advertising revenues on Ask Leo! are down, and it is impacting my ability to put out the site.

That being said, I do have an article on the site called "What are these ads that look like links on your site?" and it includes instructions for disabling those ads, specifically from Ask Leo!

Yes, it involves modifying the host file. All I really do is identify what domains you need to redirect to

Ads pay for content

So, it can be done. I urge you to think twice about consuming content, reading content without "paying the price" of having the advertisements displayed on that site. But if a site has advertisements that are so distracting and so egregious then, actually, I strongly encourage you to do two things:

  1. Tell the site owner - and if that's Ask Leo! you're complaining about, tell me.

  2. Vote with your feet. Don't go back to the site. Don't take their content without "paying for it" - just don't go back.

Websites live by traffic, and when you don't go back those are the kinds of things that also impact and send actually a bigger message to the web site owner than people blocking ads.

(Transcript lightly edited for readability.)

Article C6262 - January 21, 2013 « »

Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

January 21, 2013 6:04 PM

I don't understand when you say " I have to admit that advertising revenues on Ask Leo! are down, and it is impacting my ability to put out the site. "
You are retired from Microsoft don't you have at least one million is stock ???

Whether I do or do not isn't the point. Ask Leo! is a business, and if it can't support itself then like any business it will cease to exist. The larger issue is for any website trying to survive - without the revenue to pay the bills after a point there's typically no point to continuing.

January 22, 2013 8:49 AM

Leo - Perhaps there is a misunderstanding? Reading this page, at first I took the idea of pop-up ads differently than you do. There are the ones that pop up when you hover over a link, sure. Just don't hover! ... But the really annoying ones are the floating ads that spring up and cover half the page you are trying to read and insist on being clicked on to remove them. The internet used to be a happy experience, remember? Oh for a return to Windows 3.1...

January 22, 2013 9:02 AM

How do we help increase your revenue with those links? Is there a counter that shows how many times the link is activated? I don't mind rolling onto each link when I read a page. They don't stay long.

I could be (severely) penalized for click fraud if people start artificially clicking on ads. Don't do that. Treat my ads like you would any ad - if it's interesting, great, if it's not, ignore it. That's how the system works best.

January 22, 2013 10:21 AM

All the same, those sliding "popups" you are talking about are an element of the page you are viewing (no matter how big they are) and have nothing to do with the operating system or version of your computer. Leo's suggestions are still the only thing you can do about it.

January 22, 2013 10:27 AM

I'm a web designer and know that online ad networks have ways of tracking any sort of clicking fraud, such as users or site owners clicking on ads just to make money. So only click on the ads you are actually interested in. That will give a natural reading. Just mousing over them probably doesn't count as a click.

One of the best things you can do, as Leo says regularly in the newsletter, is share the site on social networks. When you like a page, click the "Like" button, and also share his Facebook page with your friends. That really does help.

January 22, 2013 10:39 AM

Unfortunately, it's those people/businesses who allow any and all advertising, no matter how much it bothers their users that cause trouble for people like Leo.

I used my hosts file to block annoying ads on another website. Unfortunately it had the downside of also blocking ads on Ask-Leo. This affects Leo's revenues, not something I wanted to happen.

Unfortunately, I need the other website, so I can't just show my displeasure with my feet and walk away. And even if I could, I am one out of millions of people using their website. They wouldn't notice me.

January 22, 2013 5:14 PM

I truly hate ads that move or blink, for they prevent me from concentrating on the page content.
I have 2 recipes against them.
1. Start IrfanView, choose "always on top" in the menu, and place its black empty rectangle over the ad. Usually solves the problem.
2. Make a pdf print of the page, and read that instead of the web page itself. Also allows you to read offline.

January 23, 2013 4:11 PM

Regularly clean cookies or even disable them. You can use ccleaner {free} to do this.

Many ads are targeted from previous sites you may have visited.

January 23, 2013 9:37 PM

I use an extension to Chrome called AdBlock - it allows me to exclude certain websites such as and I am no longer distracted by annoying advertisements for everything I've ever googled!

January 23, 2013 10:35 PM

I fully agree with you Leo. There are simply no 'free lunches' anywhere in the world. It's impractical as you say. If I don't pay for what I get, I've to let someone else to pay on my behalf atleast, and tolerate a reasonable trouble in return!

For I what I get from Leo, I'll be glad to click some links too if it helps to keep his valuable information FREE for all!

Mark J
January 24, 2013 2:12 AM

If a pop-up ad used existing cookies on you machine, deleting them might prevent ads targeted by those cookies, but I doubt if they would reduce the number of pop-ups. Without cookies, the pop-ups would just be of a more generic nature.

Mark J
January 24, 2013 2:26 AM

@Mr. Shanker
Clicking on a lot of ad links in a website can have a negative effect. Google AdSense and other contextual ad services monitor for what they call click fraud, and if one person clicks on too many links, the website can be penalized, even to the extent of having it's ad account closed down. So it's safer just to click on ads that might interest you.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.