My first thread in newless clubies So what is the best way to load up a browser when a user clicks a link?
I have some HTML help documentation that I would like loaded up in a browser. One option I guess is to use a Java HTML renderer but I think a full browser is better suited.
For windows the best way of loading a URL I can see is "start http://google.com/
". This will load the URL in the user's default browser.
For other OS's it gets a bit harder. I don't like the idea of making an assumption for linux that a user has one browser or another, for example old code used to assume "netscape" but now many people don't use that and use mozilla instead.
So I guess my choice is test for the existance of a particular browser (this could be changed in a user config file) and if none is found just display a box saing "goto http://google.com
" - or just display the box first up.
There exists a Sourceforge project that has the right ideas http://browserlauncher.sourceforge.net/
but is too old now. Which presents a problem in itself - I don't want to update this code every year so somthing which lasts is better. So is this windows "start" command going to be around for a while?
This article I also found but was of little help:http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
as i can't see "rundll32 url.dll,FileProtocolHandler http://www.javaworld.com
" being any better than a simple "start" command (I wounder if the author even knew about that command?).
I believe that "start" should run in windows 98 in the manner I am using it (file associations) as this document suggests: http://www.lagmonster.org/docs/DOS7/y-start.html
Does anyone have any experiances with this that they can share? Is there any magical way around this problem? Will Java1.5 have some spiffy method like "System.openURLInBroswer"
The best I have thus far is to use "start" with windows, and in linux test for the existance of "mozilla", if it exists then use it else just show a text box. Enabling the user to change the linux/otherOS binary from "mozilla" to somthing else could help although it's still not ideal.
Thanks in advance,