changeset 1549:355a928871ff

Gracefully accept browser's refusal to let us set certain AJAX headers
author Adam Chlipala <adam@chlipala.net>
date Fri, 26 Aug 2011 09:51:38 -0400
parents 76dab73304a5
children daf71c76707e
files lib/js/urweb.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Wed Aug 24 08:18:09 2011 -0400
+++ b/lib/js/urweb.js	Fri Aug 26 09:51:38 2011 -0400
@@ -772,8 +772,10 @@
 
     xhr.open("POST", uri, true);
     xhr.setRequestHeader("Content-type", "text/plain");
-    xhr.setRequestHeader("Content-length", "0");
-    xhr.setRequestHeader("Connection", "close");
+    try {
+        xhr.setRequestHeader("Content-length", "0");
+        xhr.setRequestHeader("Connection", "close");
+    } catch (e) { }
 
     if (client_id != null) {
         xhr.setRequestHeader("UrWeb-Client", client_id.toString());