Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
1551:5175bed443f9 | 1552:c3b5cf5c2f98 |
---|---|
734 | 734 |
735 var client_id = null; | 735 var client_id = null; |
736 var client_pass = 0; | 736 var client_pass = 0; |
737 var url_prefix = "/"; | 737 var url_prefix = "/"; |
738 var timeout = 60; | 738 var timeout = 60; |
739 var isPost = false; | |
739 | 740 |
740 function getXHR(uri) | 741 function getXHR(uri) |
741 { | 742 { |
742 try { | 743 try { |
743 return new XMLHttpRequest(); | 744 return new XMLHttpRequest(); |
906 if (isok) { | 907 if (isok) { |
907 var text = xhr.responseText; | 908 var text = xhr.responseText; |
908 if (text == "") | 909 if (text == "") |
909 return; | 910 return; |
910 var lines = text.split("\n"); | 911 var lines = text.split("\n"); |
912 | |
913 if (lines.length == 1 && lines[0] == "R") { | |
914 if (isPost) | |
915 history.back(); | |
916 else | |
917 location.reload(); | |
918 | |
919 return; | |
920 } | |
911 | 921 |
912 if (lines.length < 2) { | 922 if (lines.length < 2) { |
913 discon(); | 923 discon(); |
914 return; | 924 return; |
915 } | 925 } |