JavaScript/Browser Navigation from Java in IE4

Posted on 1998-07-10
Last Modified: 2010-08-05

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)

Question by:maddy051398
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

fontaine earned 100 total points
ID: 1225737
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;


Author Comment

ID: 1225738
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.


Expert Comment

ID: 1225739
That's probably the time to establish the connection to the site.

Author Comment

ID: 1225740
Maybe my P166 just doesn't cut it anymore!

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question