FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP3
I have been able to replicate this using Internet Explorer, versions 6 and 7. When using Firefox 3 there is no issue.
A DESCRIPTION OF THE PROBLEM :
Our application makes several calls from our applet to javascript functions defined on the hosting jsp page.
One of the things these javascript functions do it to open a new browser window to navigate to different parts of the application (using javascript window.open()).
In previous versions of the plugin these opened windows were created on top of the window hosting the applet. Since 6u10 the windows appear underneath the current window. Unless the user notices a new window has appeared on the taskbar they do not know something has happened.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an applet which calls a javascript function using JSObject.
Define a javascript function which uses window.open to open a new browser window.
Run applet, calling javascript function.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
New browser window appears on top of current window.
ACTUAL -
New browser window appears underneath current window.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
applet code as follows:
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.SwingUtilities;
import netscape.javascript.JSObject;
public class TestApplet extends JApplet {
public void init() {
super.init();
Runnable r = new Runnable() {
public void run() {
createGUI();
}
};
try {
SwingUtilities.invokeAndWait(r);
} catch (Exception e) {
e.printStackTrace();
}
}
public void createGUI() {
getContentPane().setLayout(new FlowLayout());
JButton button = new JButton("click me");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
callJS();
}
});
getContentPane().add(button);
}
public void callJS() {
JSObject.getWindow(this).call("myJSFunction", null);
}
}
html code as follows
<html>
<head>
</head>
<script type="text/javascript">
function myJSFunction() {
window.open("http://java.sun.com", "_blank", "toolbar=no, menubar=no, scrollbars=yes, resizable=yes, status=yes, location=no");
}
</script>
<body>
<applet height="100%" width="100%" code="TestApplet" archive="." mayscript>
</applet>
</body>
</html>
---------- END SOURCE ----------
Release Regression From : 6
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP3
I have been able to replicate this using Internet Explorer, versions 6 and 7. When using Firefox 3 there is no issue.
A DESCRIPTION OF THE PROBLEM :
Our application makes several calls from our applet to javascript functions defined on the hosting jsp page.
One of the things these javascript functions do it to open a new browser window to navigate to different parts of the application (using javascript window.open()).
In previous versions of the plugin these opened windows were created on top of the window hosting the applet. Since 6u10 the windows appear underneath the current window. Unless the user notices a new window has appeared on the taskbar they do not know something has happened.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an applet which calls a javascript function using JSObject.
Define a javascript function which uses window.open to open a new browser window.
Run applet, calling javascript function.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
New browser window appears on top of current window.
ACTUAL -
New browser window appears underneath current window.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
applet code as follows:
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.SwingUtilities;
import netscape.javascript.JSObject;
public class TestApplet extends JApplet {
public void init() {
super.init();
Runnable r = new Runnable() {
public void run() {
createGUI();
}
};
try {
SwingUtilities.invokeAndWait(r);
} catch (Exception e) {
e.printStackTrace();
}
}
public void createGUI() {
getContentPane().setLayout(new FlowLayout());
JButton button = new JButton("click me");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
callJS();
}
});
getContentPane().add(button);
}
public void callJS() {
JSObject.getWindow(this).call("myJSFunction", null);
}
}
html code as follows
<html>
<head>
</head>
<script type="text/javascript">
function myJSFunction() {
window.open("http://java.sun.com", "_blank", "toolbar=no, menubar=no, scrollbars=yes, resizable=yes, status=yes, location=no");
}
</script>
<body>
<applet height="100%" width="100%" code="TestApplet" archive="." mayscript>
</applet>
</body>
</html>
---------- END SOURCE ----------
Release Regression From : 6
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- duplicates
-
JDK-6980283 Opening a new browser window via javascript creates the window behind current
-
- Closed
-
-
JDK-6780276 Applet calls JS window.open() causes a new window to open in the background
-
- Closed
-
-
JDK-6988515 Windows opened through the JSObject pop-up behind the main applet window.
-
- Closed
-
- relates to
-
JDK-6783619 showDocument calls result in the new browser window opening behind the current top window.
-
- Closed
-