[OpenLayers-Users] Further to openlayers, IE8 and local files.

christopher.schmidt at nokia.com christopher.schmidt at nokia.com
Fri Apr 16 07:33:54 EDT 2010


On Apr 15, 2010, at 9:49 PM, ext Phil Scadden wrote:

> If I change XMLHttpRequest to
>
>     function cXMLHttpRequest() {
>         if (window.location.protocol == "file:") {
>              this._object    =   new
> window.ActiveXObject('Microsoft.XMLHTTP');
>         } else {
>             this._object    = oXMLHttpRequest ? new oXMLHttpRequest :
> new window.ActiveXObject('Microsoft.XMLHTTP');
>         }
>     };
>
> then the code works in IE8. (Obviously doesnt in FF - I am hoping
> someone better in JS can fix this up).
>
> The fix need to work for requests are going to both web and file  
> (could
> have layers from both). jQuery's structure seems good for this.

It is not possible to make XMLHttpRequest requests from file:  
locations in modern versions of Firefox. This is a security  
restriction, and I am not aware of any way around it. If you want  
something that works from a USB stick and works across all browsers, I  
recommend including a local web server and serving files from that.  
The http://labs.metacarta.com/on-a-stick/ distribution includes a  
setup that does this.

-- Chris



More information about the Users mailing list