[OpenLayers-Users] Problem (and possible solution) for Openlayers + IE8 + local files.

Phil Scadden p.scadden at gns.cri.nz
Thu Apr 15 20:39:03 EDT 2010


I have been having trouble with "access denied" using openlayers on a 
USB stick (off internet) application when the browser is IE8. Hassles 
with ajax (possibly) and with XMLHttpRequest. I noticed that ajax via 
JQuery has no problem so started comparing code.

It would seem that the in IE7 8, the xmlhttprequest is implemented, but 
it doesnt work for local files. You
have to use the ActiveXObject (XMLHTTP) instead. JQuery seems to do this 
thanks a look at
window.document.protocol == "file:".

It seems to fix this you need to change in ajax.js
  getTransport: function() {
         return OpenLayers.Util.Try(
             function() {return new XMLHttpRequest();},
             function() {return new ActiveXObject('Msxml2.XMLHTTP');},
             function() {return new ActiveXObject('Microsoft.XMLHTTP');}
         ) || false;
     },
(I did this successfully) but also
XMLHttpRequest.js
     function cXMLHttpRequest() {
         this._object    = oXMLHttpRequest ? new oXMLHttpRequest : new 
window.ActiveXObject('Microsoft.XMLHTTP');
     };

I am less sure of exactly what this code is trying to achieve so 
reluctant to fiddle. Would someone like to give this a go?


-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.




More information about the Users mailing list