From 7341ac96f34019ce6b4cadd05782eb97542e2663 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Tue, 20 Nov 2007 21:36:24 +0000 Subject: [PATCH] If a param 'redirect_on_finish' is given to the applet, redirect to that URL when we've finished getting down. This allows us to have some javascript on that redirected page close the window getdown was in. I'd prefer to do this with the javascript bridge from the applet into the browser, but calling window.close() from the applet doesn't seem to do anything --- .../getdown/launcher/GetdownApplet.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/getdown/launcher/GetdownApplet.java b/src/java/com/threerings/getdown/launcher/GetdownApplet.java index 54349ad..86c4242 100644 --- a/src/java/com/threerings/getdown/launcher/GetdownApplet.java +++ b/src/java/com/threerings/getdown/launcher/GetdownApplet.java @@ -115,7 +115,21 @@ public class GetdownApplet extends JApplet return GetdownApplet.this; } protected void exit (int exitCode) { - // don't exit as we're in an applet + // Redirect to the URL in 'redirect_on_finish' if we completed successfully. + // This allows us to use some javascript on that page to close Getdown's + // browser window. I'd prefer to use the javascript bridge from the applet + // rather than redirecting, but calling JSObject.getWindow(this).call("close") + // doesn't seem to do anything. + if (getParameter("redirect_on_finish") != null && exitCode == 0) { + URL dest; + try { + dest = new URL(getParameter("redirect_on_finish")); + } catch (MalformedURLException e) { + Log.warning("URL in redirect_on_finish param is malformed: " + e); + return; + } + getAppletContext().showDocument(dest); + } } };