Launch Browser with a URL
Keywords: netscape URL browser
Question:
I'm trying to start netscape and pass it a url:
Run("Netscape.exe", "")
WinActivate("~Netscape")
SendKeysTo("Netscape", "file://f:/nav/contents.htm")
Netscape starts, but SendKeysTo doesn't.
Am I activating the correct window?
Answer:
- Netscape is not real good about puting the input focus on the optional Location window. Instead try....
Run("Netscape.exe", "")
SendKeysTo("Netscape","^ofile://f:/nav/contents.htm")
The ^o in there will oprn the location input dialog box.
- Alternatively, you could do:
Run("d:\path\netscape.exe", "-hfile:///c|/autoexec.bat")
-h says to start that session with the following url as the "homepage". It only starts with that url. If you
press the "HOME" button, it will go to whatever default homepage you have.
- If you want to change the initial homepage permanently you can:
RegSetValue(@REGCURRENT, "Software\Netscape\Netscape Navigator\Main[Home Page]","url-of-choice")
Run("netscape.exe","")
- Actually if you...
ShellExecute("http://www.windowware.com","","",@NORMAL,"OPEN")
That works.
To open URL without launching another instance of your Browser:
As described in Section 2.1.2, calling the Netscape executable with an URL as its parameter will always open
up a new browser
window. However, there is also a way of making your current browser window show a document. This approach
uses the DLL url.dll. If
you want to try it, issue the following command in a DOS shell:
rundll32 url.dll,FileProtocolHandler http://www.infosys.tuwien.ac.at
See:
http://www.infosys.tuwien.ac.at/Staff/pooh/Minstrel/Receiver/NRCF/concept/methods.html
and
http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
Article ID: W13351
Filename: Launch Browser with URL.txt