PDA

View Full Version : Opening a page in a Java applet


Paul C. Anagnostopoulos
23rd June 2006, 06:31 PM
Java applet experts,

I asked this question awhile ago, but perhaps new information has come to light.

Is there any platform-independent way of opening up a new browser page from a Java applet? Considering the context of a Java applet, you'd think it would be trivial, yet I cannot figure out a way to do it. I want to be able to present help information on the applet by opening a page directed to an external site when the user pokes a Help button.

Any help, so to speak, would be appreciated.

~~ Paul

kevin
23rd June 2006, 07:36 PM
Is there any platform-independent way of opening up a new browser page from a Java applet?

these guys seem to have bundled up a bunch of platform-dependent ways to create a class that is effectively platform-indpendent (until a new platform comes out I guess).

http://sourceforge.net/projects/browserlaunch2/

it's under the GPL or LGPL, not sure if that matters.

skoob
24th June 2006, 07:01 AM
Maybe I'm misunderstanding you, but wouldn't it be easier to just have a link to the help page in the actual web page (in which your applet is embedded)?

If you don't want the link to be displayed all the time, you could alter the web page from the applet using the DOM (see JSObject).

Paul C. Anagnostopoulos
24th June 2006, 04:03 PM
That's what we do now, but I'd like to be able to open a separate browser page with the help.

~~ Paul

skoob
25th June 2006, 01:40 AM
In other words, you want the help page to open in a new window?

Why not just use target="_blank" or Javascript to pop up a new window? Here's an article that describes how to achieve that (I'm just a couple of posts away from being able to post real links ;): devarticles.com/c/a/Web-Design-Usability/Building-Friendly-Popup-Windows/

Paul C. Anagnostopoulos
25th June 2006, 06:56 AM
The problem is that I can't find a platform-independent method of opening a page at all. Remember that I'm writing a Java applet, which has restrictions on what it can do (for example, it can't write a local file).

I'll look into BrowserLaunch2.

~~ Paul

Dogbreath
4th July 2006, 08:55 AM
I was thinking about your question and I came up with an idea involving a kludge way of doing it involving a hidden field and setTimeout function to call itself and check the value in the browser which would have been modified by the applet. But then I came accross this code, it looks like it might be able to do what you want.


http://www.rgagnon.com/javadetails/java-0172.html