diff lib/js/urweb.js @ 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 ade93cd5bc59
children c3b5cf5c2f98
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());