From 6662001aae844166b2cd0972767151edf34bff86 Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Tue, 10 Feb 2015 18:28:05 -0500 Subject: [PATCH] Fixed Firefox 35 not able to open local files (#588) --- changelog.txt | 1 + src/openseadragon.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4393908a..81d77fbf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -51,6 +51,7 @@ OPENSEADRAGON CHANGELOG * Added support for HDPI (retina) displays (#583) * Corrected IIIF tile source to use canonical syntax (#586) * Fixed x/y typo that caused horizontal reference strip to be rendered only relative to height (#595) +* Fixed Firefox 35 not able to open local files (#588) 1.2.1: diff --git a/src/openseadragon.js b/src/openseadragon.js index 702d6976..96971cf6 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1984,9 +1984,12 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ if ( request.readyState == 4 ) { request.onreadystatechange = function(){}; - var successStatus = - protocol === "http:" || protocol === "https:" ? 200 : 0; - if ( request.status === successStatus ) { + // With protocols other than http/https, the status is 200 + // on Firefox and 0 on other browsers + if ( request.status === 200 || + ( request.status === 0 && + protocol !== "http:" && + protocol !== "https:" )) { onSuccess( request ); } else { $.console.log( "AJAX request returned %d: %s", request.status, url );