diff --git a/pannellum.htm b/pannellum.htm new file mode 100644 index 0000000..00cc7b2 --- /dev/null +++ b/pannellum.htm @@ -0,0 +1,23 @@ + + + + + + Pannellum + + + + +
+ +
+ + + + + + diff --git a/src/js/pannellum.js b/src/js/pannellum.js index ead7333..39bfd5b 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -416,7 +416,7 @@ function init() { xhr = new XMLHttpRequest(); xhr.onloadend = function() { - if (xhr.status != 200) { + if (xhr.status != 200 && xhr.status != 0) { // Display error if image can't be loaded var a = document.createElement('a'); a.href = p; diff --git a/src/standalone/standalone.js b/src/standalone/standalone.js index c33155a..310e6ba 100644 --- a/src/standalone/standalone.js +++ b/src/standalone/standalone.js @@ -83,7 +83,7 @@ function parseURLParameters() { // Get JSON configuration file request = new XMLHttpRequest(); request.onload = function() { - if (request.status != 200) { + if (request.status != 200 && request.status != 0) { // Display error if JSON can't be loaded var a = document.createElement('a'); a.href = configFromURL.config; @@ -114,6 +114,14 @@ function parseURLParameters() { configFromURL.escapeHTML = true; viewer = pannellum.viewer('container', configFromURL); }; + request.onerror = function(e) { + // Display error if opened from local file + if (window.location.protocol == 'file:') + anError('Due to browser security restrictions, loading Pannellum files from the local filesystem has been denied; ' + + 'use the Chrome/Opera command-line option "--allow-file-access-from-files" or some sort of local web server.'); + else + anError("Error loading "+configFromURL.config); + } request.open('GET', configFromURL.config); request.send(); return; @@ -129,11 +137,5 @@ function parseURLParameters() { viewer = pannellum.viewer('container', configFromURL); } -// Display error if opened from local file -if (window.location.protocol == 'file:') { - anError('Due to browser security restrictions, Pannellum can\'t be run ' + - 'from the local filesystem; some sort of web server must be used.'); -} else { - // Initialize viewer - parseURLParameters(); -} +// Initialize viewer +parseURLParameters();