Reputation: 81104
I have a Java Applet that interacts with the Java Plugin to show a document (just a URL) in a named browser window:
public class TestApplet extends Applet {
@Override
public void init() {
super.init();
final JButton showButton = new JButton("Show Google!");
showButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
try {
getAppletContext().showDocument(new URL("http://google.com"), "Some Window Title");
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
}
});
add(showButton);
}
}
This has worked historically but starting with Java 7 and Java 6u27, the window fails to open in Internet Explorer (tested in IE 8). If I use _blank
as the window title (target) instead of Google
, the window opens correctly (albeit in a new window each time).
I've tracked down this bug that was fixed for 6u27:
Has anybody else experienced the same behaviour? Have you found a workaround (other than using "_blank")?
Updated the example. I wasn't actually using "Google" as the target, I was using "Some Window Title" (sorry!). It seems like this problem is unique to targets with spaces in the name.
Upvotes: 0
Views: 1131
Reputation: 11
Try this code, it should work.
Desktop desktop = Desktop.getDesktop();
desktop.browse(new URI(info));
Upvotes: 1
Reputation: 168835
It seems like this problem is unique to targets with spaces in the name.
Two possible solutions:
Upvotes: 1