Steps to Reproduce Behavior
- Save the following to a file named testApp.java:
import java.applet.Applet;
import java.awt.*;
public class testApp extends Applet
{
Button b1;
public void init ()
{
b1 = new Button("Press");
add("Center", b1);
}
public boolean action(Event ev, Object arg)
{
if (arg.equals("Press"))
{
try
{
System.out.println("Exiting now.");
System.exit(0);
}
catch (Exception ex)
{
if (ex instanceof SecurityException)
System.out.println("Cannot exit browser");
else
ex.printStackTrace();
}
}
return true;
}
}
- Compile the file.
- You will need to use the tools from the SDK for Java to cab and
sign the applet.
- Run the applet in Internet Explorer 4.0x.
- Notice that when you click the Press button your browser session will
terminate.
NOTE: If you run the applet and it is not cabbed and signed, your browser
session will not terminate when you press the button labeled "Press."
Rather, you will observe an error message in the javalog, which may be
viewed (in Internet Explorer 4.01) by opening the Java Console.