mos
asked on
Showing Web-Page in a Browser from Applikation ?
How can I open a Web Page in a Browser from a Java Applikation ?
I wanna send a URL from a Java Applikation to the default Browser on the System (e.g. IE, Communicator)!
Further more I want to decide if the page will open in a new
Browser-Window or in an old one!
Thanks for helping
I wanna send a URL from a Java Applikation to the default Browser on the System (e.g. IE, Communicator)!
Further more I want to decide if the page will open in a new
Browser-Window or in an old one!
Thanks for helping
But how to get the "Default" browser program and it's pathname?
I think we need a native method to help us to find it out.
I think we need a native method to help us to find it out.
ASKER
Threshold, you are right.
I really need a way to get the "default" browser and the possibility to open pages in an old window (preventing to open hundreds of different browser windows)!
So, how does the nativ method look like on a win32 system ?
I really need a way to get the "default" browser and the possibility to open pages in an old window (preventing to open hundreds of different browser windows)!
So, how does the nativ method look like on a win32 system ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you want it to run in NT....
In NT Resource Kit, You can find the tool(RegGet.exe... i forgot the name...) to get informations from NT Registry.
So. use the Runtime.exec() to run the tool.
First, you get the HKEY_CLASSES_ROOT/.html/Co ntent Type = NetscapeMarkup
Second, you can find HKEY_CLASSES_ROOT/Metscape Markup/ope n/command =
C:\PROGRA~1\Netscape\COMMU N~1\Progra m\netscape .exe "%1"
Then you can find the default browser to open .html file... and use Runtime.exec() to open any document with C:\....\netscape.exe
In NT Resource Kit, You can find the tool(RegGet.exe... i forgot the name...) to get informations from NT Registry.
So. use the Runtime.exec() to run the tool.
First, you get the HKEY_CLASSES_ROOT/.html/Co
Second, you can find HKEY_CLASSES_ROOT/Metscape
C:\PROGRA~1\Netscape\COMMU
Then you can find the default browser to open .html file... and use Runtime.exec() to open any document with C:\....\netscape.exe
[jdyer] - If the window handler is a must, than that may present a problem, since through JNI its not easy to get a HWND of the java application.
teh window handler is only the handler of the parent window. Thus, just send null, and the parent will be the desktop. How does that sound?
teh should be "the"
Sorry, so instead of above in my proposed answer, it SHOULD be
ShellExecute( null, "open", "http://www.yahoo.com", null, getProperties( "acl.write" ), 1 );
The First arg is null because we want the window's parent to be the desktop;
The Second arg is "open" because we want to open http://www.yahoo.com
The Third arg is "http://www.yahoo.com" because we want to connect to Yahoo! (this can be anything.
The Fourth arg is null because we don't want any parameters
The fifth is the current directory for the application, this can be anything really, I just chose the directory where applets can write to
The fifth is SW_SHOWNORMAL (which equals 1) because that is the type of window we want.
Hopefully that will clarify things a bit
Regards,
jdyer
Sorry, so instead of above in my proposed answer, it SHOULD be
ShellExecute( null, "open", "http://www.yahoo.com", null, getProperties( "acl.write" ), 1 );
The First arg is null because we want the window's parent to be the desktop;
The Second arg is "open" because we want to open http://www.yahoo.com
The Third arg is "http://www.yahoo.com" because we want to connect to Yahoo! (this can be anything.
The Fourth arg is null because we don't want any parameters
The fifth is the current directory for the application, this can be anything really, I just chose the directory where applets can write to
The fifth is SW_SHOWNORMAL (which equals 1) because that is the type of window we want.
Hopefully that will clarify things a bit
Regards,
jdyer
I comment this answer so that someone may answer better regarding the displaying of URLs in a currently open brawser.
G.