JDK-6735312 : AppletContext.showDocument fails silently in IE7 if target contains hyphens
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u5,6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows,windows_vista
  • CPU: generic,x86
  • Submitted: 2008-08-08
  • Updated: 2011-02-16
  • Resolved: 2008-10-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u10 b32Fixed
Description
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b27)
Java HotSpot(TM) Client VM (build 11.0-b14, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6001]

A DESCRIPTION OF THE PROBLEM :
AppletContext.showDocument fails silently in IE7 if target contains hyphens.

If you disable the new plugin architecture in the java control panel then it works.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.net.*;

public class ShowDocument extends Applet implements ActionListener
{
    public ShowDocument ()
    {
	Panel p = new Panel();
	p.setLayout( new FlowLayout() );

	Button b = new Button( "Works" );
	b.addActionListener( this );
	p.add( b );

	b = new Button( "Does Not Work" );
	b.addActionListener( this );
	p.add( b );

        add( "Center", p );
    }

    public void actionPerformed ( ActionEvent e )
    {
	String command = e.getActionCommand();
        URL url = null;
        try
        {
            url = new URL( "http://www.google.com" );
        }
        catch ( MalformedURLException ex )
        {
            throw new Error( ex );
        }
	if ( "Works".equals( command ) )
        {
            String target = "works";
            getAppletContext().showDocument( url, target );
	}
        else if ( "Does Not Work".equals( command ) )
        {
            String target = "does-not-work";
            getAppletContext().showDocument( url, target );
	}
        else
        {
            throw new Error( "unknown command: " + command );
	}
    }

    public static void main ( String args[] )
    {
	Frame f = new Frame( "ShowDocument" );
	ShowDocument sd = new ShowDocument();
	sd.init();
	sd.start();
        f.add( "Center", sd );
	f.setSize(300, 100);
	f.show();
    }
    
    public String getAppletInfo()
    {
        return "Demonstrates that some frame targets do not work with IE 7.0.6001 and Java 1.6u10 and new plugin.";
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Don't put hyphens in your targets?!

Comments
SUGGESTED FIX webrev: http://sa.sfbay.sun.com/projects/deployment_data/6u11/6735312.0 testcase: http://j2se.east.sun.com/deployment/www/tests/1.6.0_11/6735312/
04-09-2008

EVALUATION There are bugs in IE preventing some JavaScript from targeting a particular frame if the frame's name contains hyphens. (Firefox does not have the same bugs.) It appears that as a workaround for these bugs, the classic Java Plug-In used to mangle the names of frame targets, which would cause the showDocument() call to open the URL in a new browser window. The new Java Plug-In was silently failing to show these showDocument requests. It turns out that there is a way to phrase the JavaScript to work around the bugs in IE. This workaround has been implemented, and a fallback to the classic Java Plug-In's behavior is used if this workaround does not work, in particular in the case where the frame target does not exist. The test case covers both of these scenarios.
04-09-2008