Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Pop-up killing http proxy

by Stegalex (Chaplain)
on Sep 02, 2002 at 18:24 UTC ( #194618=perlquestion: print w/replies, xml ) Need Help??

Stegalex has asked for the wisdom of the Perl Monks concerning the following question:

Having recently installed Spamnet on my machine, I got to thinking - wouldn't it be nice if the same technology could be used to discriminate between nuisance pop-ups (e.g. ads) and legitimate pop-ups (stuff you might code)?

My question is this: Where is a good Perlish starting point for building an http proxy which would filter out ads by rewriting Javascript on the fly and removing all Flash? It would also be nice if the community could vote on any pop-ups that got through in order to help in the identification of undesirable ads.

I like chicken.

Replies are listed 'Best First'.
Re: Pop-up killing http proxy
by sauoq (Abbot) on Sep 02, 2002 at 18:37 UTC
    Where is a good Perlish starting point for building an http proxy which would filter out ads by rewriting Javascript on the fly and removing all Flash?

    Rewriting JavaScript on the fly is going to be quite literally impossible to get right. You might as well just strip it out. Of course, there's no reason not to just turn it off in your browser.

    There are other ways to avoid the bulk of nuisance ads. One easy trick that you can use is to put fake entries in your hosts table for sites that serve them. This is especially useful for those that have chaining pop-ups and pop-unders where another one opens up as soon as you close one.

    "My two cents aren't worth a dime.";
      True, I can turn off Javascript but then a lot of things won't work properly. Stripping out selective Javascript and Applet tags would be a good start I suppose. I am intrigued by what you said about the hosts table. Is this something I can do on a Windows box?

      I like chicken.

        Under WINNT/WIN2K/WINXP the hosts file is located in


        Try this search to find more info on setting it up and also pre-configured hosts files for blocking server known to serve pop-up adds. Beware, they can get pretty big. Mine is currently 450k or near 12500 lines. This does not seem to have any noticable effect on my browsing, but others have reported some degradation.

        I haven't seen a pop-up for ... well, a long, long time.

        Then again, I don't have js enabled except for specific sites and Opera 6 has a built-in pop-up refusal option too.

        As my Dad would have said. "A belt and braces man".

        Also, I have no knowledge of the one you mentioned, but in the past I used an ad blocking proxy that seemed fairly effective called Proxomitron, which has some pretty nifty features, regex search and replace etc, but the maintainence was quite high. The hosts file solution is infinitly better.

        Well It's better than the Abottoire, but Yorkshire!

        Yes, you can. Take a look at c:\windows\hosts.sam.

        Create a file called c:\windows\hosts and insert a line like

        to block the domainname Incidentially, you can even add       project1       project2

        and configure a webserver (e.g. apache) to run on these adresses, and you'll have a nice way to test-drive your websites, if you develop any.

Re: Pop-up killing http proxy
by Aristotle (Chancellor) on Sep 02, 2002 at 20:36 UTC
    Too much trouble to go rolling your own: you can just use Privoxy, successor of the infamous Junkbuster.

    Makeshifts last the longest.

Re: Pop-up killing http proxy
by nmerriweather (Friar) on Sep 02, 2002 at 23:18 UTC
    you can also take advantage of the host file project! works on all os's -- just place the hosts file where it goes for your os, and all material from those servers (several thousand, kept up to date) is summarily rejected you still get popups and iframes -- but they're all blank. makes loading pages super fast!
Re: Pop-up killing http proxy
by richardX (Pilgrim) on Sep 03, 2002 at 09:28 UTC
    I use the program Adsubtract that comes with Zonealarm from Zone Labs. It allows for tons of configuration and it puts a JavaScript blocker into every HTML file retrieved automatically.


    There are three types of people in this world, those that can count and those that cannot. Anon

Re: Pop-up killing http proxy
by schumi (Hermit) on Sep 03, 2002 at 06:28 UTC
    It's not really Perl-ish, but I use the Proximitron. It does the job very nicely, killing pop-ups and lots of other annoying stuff. You can configure it "down to the creek", as we say in Swiss German.

    The only disadvantage is that you need two additional dlls if you want to use ssl - of which I can't remember where I got them. But you can find them easily with google or any other search engine. The documentation is quite good.


    There are nights when the wolves are silent and only the moon howls. - George Carlin

Re: Pop-up killing http proxy
by strredwolf (Chaplain) on Sep 03, 2002 at 05:38 UTC
    I have a very raw, module-less proxy called wsproxy you can try.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://194618]
Approved by talexb
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-05-20 20:42 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (76 votes). Check out past polls.