[fusion-dev] IE6 support XMLHttpRequest

JP_Staff jpps975 at sbcglobal.net
Thu Oct 8 10:03:54 EDT 2009


To All,

Current Environment
IE6-8, .Net, IIS7, Mapguide2010, WS2008, OpenLayers 2.8

I currently downloaded the latest version from
http://svn.osgeo.org/fusion/trunk and ran into a slight issue
with XMLHttpRequest being null in IE6. After further investigation I ended
up adding some code at the top of my Fusion.js file to include all previous
versions of IE

if (typeof XMLHttpRequest == "undefined")
    XMLHttpRequest = function() {
        try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch (e) { }
        try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch (e) { }
        try { return new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { }
        try { return new ActiveXObject("Microsoft.XMLHTTP") } catch (e) { }
        throw new Error("This browser does not support XMLHttpRequest.")
    };
This seems to work perfectly, the XMLHttpRequest error has not presented
itself again. Although, I have run into the authentication popup when the
XMLHttpRequest object gets initialized for accessing the mapagent
url.(current version fusion.js around lines 1210)
var xhr = new XMLHttpRequest();
            var mapAgentUrl = getAgentUrl();
            xhr.open("GET", mapAgentUrl +
"?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID="
+ appDefUrl + "&FORMAT=text%2Fxml", false);
            xhr.send(null);
I went ahead and passed in my authentication credential and this has seemed
to work.
var xhr = new XMLHttpRequest();
            var mapAgentUrl = getAgentUrl();
            xhr.open("GET", mapAgentUrl +
"?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID="
+ appDefUrl + "&FORMAT=text%2Fxml", false,adminUID,adminPWD);
            xhr.send(null);
            
Is there a cleaner way around this, or should I stick with this work around
for the time bieng.

Thanks,
Jean-Paul
            
-- 
View this message in context: http://n2.nabble.com/IE6-support-XMLHttpRequest-tp3788235p3788235.html
Sent from the Fusion Developers mailing list archive at Nabble.com.


More information about the fusion-dev mailing list