New Year – More Blogging

I will try to cover my experiences with the Sakai project more fully. It will probably mean that my writing will be more inane as the blog will become more of a diary. Oh well. I apologize in advance.
Today was a lot of meetings but I indilged myself and worked on trying to replace the Sakai Courier function with an iframe and refreash with XMLHttpRequest object.
Things went well, except that nothing ever worked on Mike Elledge’s computer. Finally it came down to the fact that caching was happening.
A good refernece is available at: http://developer.apple.com/internet/webcontent/xmlhttpreq.html
So the lesson is to hack the URL so that no matter what caching is happening. Here is some code that is a bit more sophisitcated than the Apple example.

function loadXMLDoc(url) {
if ( req && callInProgress(req) ) {
alert("Previous request had not completed stat="+req.status+" state="+req.readyState+" url="+lastUrl);
req.abort();
}
// Add a random number to defeat caching regardless of the user setting
lastUrl = url + "&rand=" + Math.random();
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
if ( req ) {
req.onreadystatechange = processReqChange;
req.open("GET", lastUrl, true);
req.send(null);
setStatus("XML Request started ("+couriertries+")"+lastUrl);
} else {
alert("Cannot create XML Request Object");
}
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", lastUrl, true);
req.send();
setStatus("ActiveX Request started ("+couriertries+")"+lastUrl);
} else {
alert("Unable to create ActiveX object!");
}
} else {
alert("There is no support for XMLHttpRequestObject"+url);
}
}
function callInProgress(xmlhttp) {
switch ( xmlhttp.readyState ) {
case 1, 2, 3:
return true;
break;
// Case 4 and 0
default:
return false;
break;
}
}