S
segalsegal
It has been a long time since one could rely on showDocument opening a
new browser window because browsers have needed to defend against pop-
ups. However, those of us using digitally signed applets were able to
use code such as that shown below to use Runtime.exec to do the same
thing.
Recently, however, we've been getting reports from users of our large
applet that for some people using Internet Explorer the code no longer
works on Windows XP and Vista. I've tested various configurations of
Internet Explorer on XP and Vista and not run into this limitation;
i.e. the showInBrowser code below works fine.
I'm wondering whether there are settings that would cause this code to
fail. Does anyone have any ideas?
final static void showInBrowser(URL url)
{
try
{
if (microsoftBrowser && windowsOS) Runtime.getRuntime().exec
("iexplore.exe " + url);
else if (firefoxBrowser && windowsOS) Runtime.getRuntime().exec
("firefox.exe \"" + url + "\"");
else if (macOS)
{
if (firefoxBrowser) Runtime.getRuntime().exec(new String[] {"open",
"-a", "Firefox.app", url.toString()});
else if (safariBrowser) Runtime.getRuntime().exec(new String[]
{"open", "-a", "Safari.app", url.toString()});
else Runtime.getRuntime().exec(new String[] {"open", url.toString
()});
}
else appletContext.showDocument(url, "_blank");
}
catch (Exception e)
{
System.out.println("Couldn't show in browser: " + e);
}
}
new browser window because browsers have needed to defend against pop-
ups. However, those of us using digitally signed applets were able to
use code such as that shown below to use Runtime.exec to do the same
thing.
Recently, however, we've been getting reports from users of our large
applet that for some people using Internet Explorer the code no longer
works on Windows XP and Vista. I've tested various configurations of
Internet Explorer on XP and Vista and not run into this limitation;
i.e. the showInBrowser code below works fine.
I'm wondering whether there are settings that would cause this code to
fail. Does anyone have any ideas?
final static void showInBrowser(URL url)
{
try
{
if (microsoftBrowser && windowsOS) Runtime.getRuntime().exec
("iexplore.exe " + url);
else if (firefoxBrowser && windowsOS) Runtime.getRuntime().exec
("firefox.exe \"" + url + "\"");
else if (macOS)
{
if (firefoxBrowser) Runtime.getRuntime().exec(new String[] {"open",
"-a", "Firefox.app", url.toString()});
else if (safariBrowser) Runtime.getRuntime().exec(new String[]
{"open", "-a", "Safari.app", url.toString()});
else Runtime.getRuntime().exec(new String[] {"open", url.toString
()});
}
else appletContext.showDocument(url, "_blank");
}
catch (Exception e)
{
System.out.println("Couldn't show in browser: " + e);
}
}