FELIX-592 Refactor Client Side JavaScript to enable the console
in Internet Explorer: The stuff is completely built as DOM and
only serialized when required from document.write()
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@671466 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/resources/res/ui/admin.js b/webconsole/src/main/resources/res/ui/admin.js
index 3fe3697..0739c71 100644
--- a/webconsole/src/main/resources/res/ui/admin.js
+++ b/webconsole/src/main/resources/res/ui/admin.js
@@ -125,15 +125,23 @@
url = document.location;
} else if (url.charAt(0) == '?') {
url = document.location + url;
- }
+ }
+ priv_callback = callback;
+
xmlhttp.open(method, url);
+
+ // set If-Modified-Since way back in the past to prevent
+ // using any content from the cache
+ xmlhttp.setRequestHeader("If-Modified-Since", new Date(0));
+
xmlhttp.onreadystatechange = handleResult;
- xmlhttp.priv_callback = callback;
xmlhttp.send(null);
}
+var priv_callback = null;
+
function handleResult() {
var xmlhttp = getXmlHttp();
if (!xmlhttp || xmlhttp.readyState != 4) {
@@ -145,8 +153,18 @@
return;
}
- if (xmlhttp.priv_callback) {
- var obj = eval('(' + result + ')');
- xmlhttp.priv_callback(obj);
+ var theCallBack = priv_callback;
+ priv_callback = null;
+
+ if (theCallBack) {
+ try
+ {
+ var obj = eval('(' + result + ')');
+ theCallBack(obj);
+ }
+ catch (e)
+ {
+ // error evaluating response, don't care ...
+ }
}
}