Microsoft pop-up blocker blocks Sun Java's showDocument, restarts applets

The Microsoft pop-up blocker released with Windows XP SP2 blocks Java's showDocument method.  The applet on this page demonstrates this problem: click the button in the applet and the new browser window will not pop up if the Microsoft pop-up blocker is on and you are using the Sun Java Virtual Machine (but not the Microsoft Java Virtual Machine, for which  showDocument fails under other circumstances).

The Google pop-up blocker has a similar problem, but the pop-up blockers in Netscape and Firefox for Windows and Safari for Macintosh do not block showDocument.   

A workaround is for the user to click the Information Bar to allow popups, but if this is done while the applet is running it restarts the applet (using either the Sun or Microsoft Java Virtual Machine in Internet Explorer), losing the user's work in the applet.  The need to disable a popup blocker can be detected by using JavaScript to test for popup blockers.

For signed applets or for applications a workaround is to launch a new Internet Explorer window or a new message in the default e-mail program using Runtime.exec:

This seems to work for all URLs on both Windows 98 and Windows XP without destroying the applet.

If you have any insights, workarounds or comments about this test page please contact Mickey Segal.  A listing of  many Java resources is at this link.

Source code:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;

public class pop_window extends Applet implements ActionListener {

Button button;

public void init() 
{
    button = new Button("Click to pop up a new browser window");
    button.addActionListener(this);
    add(button);
}

public void actionPerformed(ActionEvent ae)
{
    if (ae.getSource() == button) 
    {
        try
        {
            getAppletContext().showDocument(new URL("https://segal.org"), "_blank");
        }
        catch(Exception e) 
        {
            System.out.println("new URL failed");
        }
    }
}
} // END OF Class pop_window