Do not check for IE and !IE. Check for available techniques to use AJAX.
Check for XMLHttpRequest
Check for ActiveXObject incl. MSXML.XMLHTTP
Check for SOAPCall
[see below @ getSupported()]
If you check for these three techniques instead of checking IE or !IE, GLM-AJAX will be able to be used with IE6/7, FF1/2, Opera and Safari.
And please test the onReadyStateChange() for Opera. I don´t think this ever worked correctly.
[see onReadyStateChange() changes]
onReadyStateChange() for Opera:
----- SNIPPET START -----------------------------------------------------------
if(xmlHttp.callbackFunction &&
(!document.all || (navigator.appName.indexOf('Opera') >= 0)))
{
xmlHttp.callbackFunction(
xmlHttp.responseXML.getElementsByTagName('return')[0].textContent
);
}
else
{
/* ... */
}
----- SNIPPET END -------------------------------------------------------------
new method getSupported()
----- SNIPPET START -----------------------------------------------------------
function AJAX
{
/* ... */
// method to get supported techniques
this.getSupported = function()
{
var XHR = (window.XMLHttpRequest != undefined);
var SOAP = (window.SOAPCall != undefined);
var MSXML = false;
try {
new ActiveXObject('MSXML2.XMLHTTP');
MSXML = true;
} catch(ex) {}
return {
'xhr' : XHR,
'soap' : SOAP,
'msxml' : MSXML
};
} // end getSupported
/* ... */
}
----- SNIPPET END -------------------------------------------------------------
changes in callService()
----- SNIPPET START -----------------------------------------------------------
OLD: var IE = (navigator.appName.indexOf("Microsoft") >= 0);
if (IE) { /* ... */ }
NEW: var supported = this.getSupported();
if(supported['xhr'] || supported['msxml']) { /* ... */ }
----- SNIPPET END -------------------------------------------------------------
Please do not think this is an perfect solution. It is only tested in small test applications and only one medium size application with success.