diff js/core.js @ 2303:e4a2a39838db

Implementation for #38 in master
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 28 Apr 2016 10:13:20 +0100
parents f7604317ac27
children 426995e02e79
line wrap: on
line diff
--- a/js/core.js	Thu Apr 28 09:57:21 2016 +0100
+++ b/js/core.js	Thu Apr 28 10:13:20 2016 +0100
@@ -430,9 +430,14 @@
                 var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml");
                 var response = xmlDoc.getElementsByTagName('response')[0];
                 if (response.getAttribute("state") == "OK") {
+                    window.onbeforeunload = undefined;
                     var file = response.getElementsByTagName("file")[0];
                     console.log("Save: OK, written "+file.getAttribute("bytes")+"B");
-                    popup.popupContent.textContent = specification.exitText;
+                    if (typeof specification.returnURL == "string") {
+                        window.location = returnURL;
+                    } else {
+                        popup.popupContent.textContent = specification.exitText;
+                    }
                 } else {
                     var message = response.getElementsByTagName("message");
                     console.log("Save: Error! "+message.textContent);