Skip to content

Commit

Permalink
give error message on local file access only when access was denied, …
Browse files Browse the repository at this point in the history
…extending hint on possible workarounds
  • Loading branch information
DDvO committed Apr 8, 2018
1 parent e77d0ea commit e0869d1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/standalone/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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;
Expand All @@ -98,11 +106,5 @@ function parseURLParameters() {
viewer = pannellum.viewer('container', configFromURL);
}

// Display error if opened from local file
if (false && 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();

0 comments on commit e0869d1

Please sign in to comment.