JavaScript/Browser Navigation from Java in IE4


Can anyone tell me how I can get IE4 to go to a web page from within a Java Applet?  There are Java classes available for NN4 that allow you to call JavaScript from Java.  In JavaScript I can get the browser to do what I want.

How can I call a JavaScript function from Java in IE4???
(or otherwise tell IE4 to load a web page)

Who is Participating?
fontaineConnect With a Mentor Commented:
You don't need to use Javascript to do this. Here is a sample applet that opens a new
browser window with the homepage of EE. There exists several options (new window,
or not, etc). Read the doc. of the showDocument() method of
to know about them.

   import java.awt.*;
   import java.applet.*;

   public class HTMLApplet extends java.applet.Applet {

       private Button button = new Button("Click me!");

       public void init() {

       public boolean action(Event event, Object action) {

           try {
               URL url = new URL("");
               AppletContext context = getAppletContext();
               context.showDocument(url,"_blank"); // <-- pops up the window...
           } catch (MalformedURLException e) {
           return true;

maddy051398Author Commented:
That did the job, thanks!

Strange that the call to showDocument() takes about 5 seconds to display the requested page (2nd parameter set to "_self")..?

Oh well.

That's probably the time to establish the connection to the site.
maddy051398Author Commented:
Maybe my P166 just doesn't cut it anymore!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.