controlling web browser in windows

Jeff Shannon jeff at
Wed Feb 27 13:38:03 EST 2002

Matthias Baas wrote:

> On Wed, 13 Feb 2002 12:33:58 -0800, Jeff Shannon <jeff at>
> wrote:
> >Of course, I then discovered that much of what I *wanted* to do, was forbidden
> >from scripts for security reasons, but that's another story.  ;)
> Reminds me of something.....recently I was also playing around with
> COM and IE and tried to navigate to a page and save it to disk.
> Navigating was no problem (using the Navigate() method) but saving the
> page didn't work. I tried to save it via the ExecWB() call, but that
> only raised an exception (which didn't really contain a useful error
> message. The message was in German, so I think it doesn't help much if
> I post it). So my question: Is that an example of what is forbidden
> from Python? Or is there a way to save the content to disk
> automatically?

I think that this is a security issue, yes.  But it's not a matter of being
forbidden to Python, specifically; it's a matter of being forbidden to *any*
script.  If IE could be told, by a script, to save files to your hard drive, then a
malicious script could save an arbitrary autoexec.bat file in your root
directory... or, more simply, save hundreds of copies of itself, filling your
entire drive.  In my case, I was looking to automatically send pages to a printer,
without human intervention, but IE forbids this because a hostile script could then
send hundreds of pages of junk to your printer.  (Since I was running from a .HTA,
where security restrictions are looser, I may have been able to work around this,
but decided that it wasn't worth the effort.  That program still requires human
operation, but we're now working on avoiding using the web interface altogether...)

> And another thing that confused me: When I start the COM makepy
> utility I don't see IE in the list ("InternetExplorer.Application"
> doesn't show up). Why not?

I believe (but I'm not certain) that the type library is identified as "Microsoft
Internet Controls", or some such equally vague thing.  :)

Jeff Shannon
Credit International

More information about the Python-list mailing list