Make XHR work for file:// urls

The response status will be 0 instead of a HTTP status code for file urls,
so we need to consider a status of 0 as success too.
This commit is contained in:
Andreas Hocevar
2016-07-28 11:45:20 +02:00
parent 3d57ea45cb
commit 7da5a5ae92
4 changed files with 10 additions and 5 deletions

View File

@@ -41,7 +41,8 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
* @private
*/
xhr.onload = function(event) {
if (xhr.status >= 200 && xhr.status < 300) {
// status will be 0 for file:// urls
if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
var type = format.getType();
/** @type {Document|Node|Object|string|undefined} */
var source;