I was helping a friend with his Tripod* site a few days ago, and soon I was very annoyed by the multitude of popup windows. I suggested he install Mozilla, but he didn't want to install such a big package for one day. Then I suggested he install the Google toolbar, but he balked at that too.
Finally, I suggested I create a quick popup blocker with Perl, which was already installed, and he said "Fine!" with a touch of irritation in his voice.
So I did, and just a few minutes later, here's the result:
#!perl use strict; use warnings; use Win32::OLE qw/EVENTS/; use Win32::OLE::Variant; my $ie = Win32::OLE->CreateObject('InternetExplorer.Application', 'Qui +t') or die "Can't start IE", Win32::OLE::LastError(); $ie->{Visible} = 1; $|++; Win32::OLE->WithEvents($ie, 'main', 'DWebBrowserEvents2'); $ie->GoHome; Win32::OLE->MessageLoop(); sub NewWindow2 { my ($self, $browser, $cancel) = @_; $cancel->Put(1); print "$self->{LocationURL} tried to open a new window!\n"; } sub OnQuit { Win32::OLE->QuitMessageLoop; }
Okay, it has some features (read limitations ;). It will block all new windows (even when you use the "Open in New Window" context menu) and it only works on the instance of IE that it started.
* Note - Tripod upgraded to 5.8 :) - but without any core modules :(
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Popup blocker for IE
by ajdelore (Pilgrim) on Jul 11, 2003 at 19:17 UTC | |
Re: Popup blocker for IE
by smalhotra (Scribe) on Jul 11, 2003 at 16:18 UTC | |
by jsprat (Curate) on Jul 11, 2003 at 16:46 UTC | |
Re: Popup blocker for IE
by maksl (Pilgrim) on Jul 12, 2003 at 10:16 UTC | |
Re: Popup blocker for IE
by puff (Beadle) on Nov 28, 2005 at 23:56 UTC | |
Re: Popup blocker for IE
by John M. Dlugosz (Monsignor) on Jul 11, 2003 at 16:14 UTC |
Back to
Cool Uses for Perl