[python-win32] Re: Windows "Browse to" message

Roger Upole rwupole at msn.com
Fri Mar 3 03:51:17 CET 2006


>> vince at weaktight.com wrote:
>>> When you open an html file or click on a link outside of a browser, 
>>> it opens it
>>> in your default browser. What I'd like to do is to catpure this message and
>>> grab the URL text string to see where the browser is going.
>>>
>>> I was looking at PyHook, but I don't think it intercepts all windows 
>>> messages,
>>> and I'm not sure this is a windows message per se.
>>>
>>> Any suggestions?
>>>
>>> thanks
>>
>> For opening local files, there's a registered handler for the file type.
>> Take a look at HKEY_CLASSES_ROOT\htmlfile\shell\open\command
>> which specifies the program that will open the file.  You might be able
>> to substitute your own handler, which just logs the request and then
>> passes it off to the original program.  The handler for internet protocol is
>> under HKEY_CLASSES_ROOT\HTTP\shell\open\command,
>> although you'd probably also need to change all handlers that point
>> to your web browser (https, ftp, etc)
>>
>>     hth
>>        Roger
> 
> Good idea.
> 
> I tried this, however, modifying that key makes browsers unhappy as they think
> they're no longer the default browser.  If this were a one-off solution, this
> would be good enough, but it needs to be transparent enough to keep the user
> happy.
> 
> Perhaps I could catch the actual HTTP network request... that sounds scary
> though

In IE, you can disable checking that it's the default browser. (don't know about
other browsers, though)  In the case of opening a local html file, there will be
no network request.

       hth
             Roger

.


More information about the Python-win32 mailing list