changeset 1751:a38623c8cfc9

Better error catching when using server save to determine if the 'Save File' should be shown in browser.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 01 Jun 2015 17:00:45 +0100
parents 1365362c12d5
children 9ef550d116d8
files core.js
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Mon Jun 01 12:56:15 2015 +0100
+++ b/core.js	Mon Jun 01 17:00:45 2015 +0100
@@ -378,10 +378,13 @@
 			console.log('Error saving file to server! Presenting download locally');
 			createProjectSave(null);
 		};
+		xmlhttp.onreadystatechange  = function() {
+			console.log(xmlhttp.status);
+			if (xmlhttp.status != 200 && xmlhttp.readyState == 4) {
+				createProjectSave(null);
+			}
+		};
 		xmlhttp.send(file);
-		if (xmlhttp.status == 404) {
-			createProjectSave(null);
-		}
 	}
 	return submitDiv;
 }