diff lib/js/urweb.js @ 1552:c3b5cf5c2f98

Gentle handling of back-button returns to pages with stale message-passing credentials
author Adam Chlipala <adam@chlipala.net>
date Sun, 28 Aug 2011 17:16:54 -0400
parents 355a928871ff
children 4105f779de7b
line wrap: on
line diff
--- a/lib/js/urweb.js	Sun Aug 28 14:43:30 2011 -0400
+++ b/lib/js/urweb.js	Sun Aug 28 17:16:54 2011 -0400
@@ -736,6 +736,7 @@
 var client_pass = 0;
 var url_prefix = "/";
 var timeout = 60;
+var isPost = false;
 
 function getXHR(uri)
 {
@@ -909,6 +910,15 @@
                     return;
                 var lines = text.split("\n");
 
+                if (lines.length == 1 && lines[0] == "R") {
+                    if (isPost)
+                        history.back();
+                    else
+                        location.reload();
+
+                    return;
+                }
+
                 if (lines.length < 2) {
                     discon();
                     return;