|more useful options|
How do I launch my browser in Win32 to go to a specified URL?by httptech (Chaplain)
|on Apr 29, 2000 at 21:21 UTC||Need Help??|
httptech has asked for the
wisdom of the Perl Monks concerning the following question:
I want to do something very simple; launch the default browser in Win32 to go to a specified URL.
I've tried all the methods below; however, none seems to be a perfect solution.
For instance, I can use the easiest method, which is simply: system("start http://www.perlmonks.org/") but that opens a console window, and this is a GUI app, so that's an undesirable result. Plus, there is a delay of at least 10-15 seconds in launching Netscape. I'm not sure if there would be the same delay with IE or another browser, but it seems to take forever. Maybe this is a bug in Win32 but I can't just accept this solution.
I can use Win32:Process to avoid the console window opening, but the delay is still there. Note that using the "start" command from the MS-DOS window does not have a delay; it's only when I call it from perl.
I can get rid of the delay by calling the browser executable directly. To do that I use Win32::Registry to get the path to the browser:
This works on my system, but when I sent this to a friend it did not work on hers. I didn't really like this method anyway, there has to be an easier way.
So, I used the Win32:OLE example from Learning Perl on Win32:
This works fine, except I'm now forcing the user to use IE instead of Netscape. And it's possible (not likely I realize) that they don't even have IE. So what happens then?
So, is there a generic way to call the default browser on Win32 that is
guaranteed to work properly on any normal system?