United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6735312 AppletContext.showDocument fails silently in IE7 if target contains hyphens
JDK-6735312 : AppletContext.showDocument fails silently in IE7 if target contains hyphens

Details
Type:
Bug
Submit Date:
2008-08-08
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2008-10-01
Component:
deploy
OS:
windows_vista,windows
Sub-Component:
plugin
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u5,6u10
Fixed Versions:
6u10 (b32)

Related Reports

Sub Tasks

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/
                                     
2008-09-04
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.
                                     
2008-09-04



Hardware and Software, Engineered to Work Together