Google Toolbar blocks Java's showDocument and Yellow Explosion Doesn't Show if Frame Used


The Google toolbar ( in Internet Explorer blocks Java's showDocument method if the user enabled the "Popup blocker" option.  The applet on this page demonstrates this problem: click the button in the frame that pops up from this applet; the new browser window will not pop up if the Google Toolbar Popup Blocker is on. 

Using Microsoft's Java Virtual Machine, if the button is in a Frame, as shown here, the little yellow explosion cursor does not appear, often leaving the user unaware that the problem is related to the Google Toolbar.  Using Sun's Java virtual machine, the yellow explosion cursor does appear.  Using Microsoft's Java Virtual Machine the yellow explosion cursor does appear if the button is in the applet itself, as shown at this link.

Google has said this is a bug and they are working on it, however Microsoft's pop-up blocker has a similar problem.  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 "Number blocked / Site popups allowed" button 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.*;

public class pop_window2 extends Applet implements ActionListener, WindowListener {

Frame frame;
Button button;

public void init() 
    button = new Button("Pop up a browser window showing a Web page");
    frame = new Frame("A frame");
    frame.setLayout(new GridBagLayout());
    frame.setBounds(100, 100, 600, 300);

public void windowOpened(WindowEvent we){}

public void windowClosed(WindowEvent we){}

public void windowIconified(WindowEvent we){}

public void windowDeiconified(WindowEvent we){}

public void windowActivated(WindowEvent we){}

public void windowDeactivated(WindowEvent we){}

public void windowClosing(WindowEvent we)
    if (we.getSource() == frame)

public void paint(Graphics g)
    g.drawString("A frame should pop up", 10 , 20);

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