Houston, we have a problem!
For a long time Chrome and Safari browsers, on the Mac, have prevented users from opening a locally saved HTML file. As there are a number of vulnerabilities associated with opening such a file both browsers felt it prudent to block it.
Firefox was the only browser that allowed a locally saved HTML file to be opened. However in a recent published bug list they identified this issue:
CVE-2019-11730:
Same-origin policy treats all files in a directory as having the same-origin
Reporter: Luigi Gubello
Impact: moderate
Description
A vulnerability exists where if a user opens a locally saved HTML file, this file can use file: URIs to access other files in the same directory or sub-directories if the names are known or guessed. The Fetch API can then be used to read the contents of any files stored in these directories and they may uploaded to a server. Luigi Gubello demonstrated that in combination with a popular Android messaging app, if a malicious HTML attachment is sent to a user and they opened that attachment in Firefox, due to that app's predictable pattern for locally-saved file names, it is possible to read attachments the victim received from other correspondents.
In response to this bug report the latest version of Firefox ‘Quantum’ now blocks opening a locally saved HTML file.
What does this mean for us?
Well, for me in my workflow, I often want to open a Pano2VR or krpano tour that I’ve built, and saved locally, without having to load the tour to my Amazon S3 server.
In the pre Quantum versions of Firefox, I could simply drag the index.html/tour.html file into the browser window or right click and select ‘Open in Firefox’ to view the tour. Now I only see partial skins and black screens. (Figures #1 & #2)
So what we need now is a simple method by which we can quickly preview the tours. That means having some way of web serving the files locally.
Note: I don’t have access to a PC to check the status of the browsers there so for now my response is only Mac based.
My #1. Option - GGPKG Viewer
Pano2VR describe the Garden Gnome Package Viewer as a native application that lets you open Pano2VR and Object2VR packages (.ggpkg) for viewing content offline. However it goes beyond that and allows you to open and view tours produced in both Pano2VR and krpano.
Pro’s:
Standalone App (does not require a license)
Works without having to have Pano2VR or KrPano running
Drag and Drop or Browse to file
Can be used to view local files on the device
Works with both Pano2VR and krpano tours
Options for Full Screen View and Kiosk Mode (Mac)
Con’s:
No configuration options to change download speeds for testing (Pano2VR integrated server does)
You can download the Mac or PC version from https://ggnome.com/ggpkgviewer
For more information on using the GGPKG check out the tutorial video by Martin Hopkins below.
#2 Option - krpano Testing Server
The krpano Testing Server is a small, simple and easy-to-use static-file localhost server. It makes it possible to test krpano HTML5 outputs locally without any local-file restrictions and without uploading. Other computers and devices in the local network will be able to view the files. Additionally it's possible to control the browser caching and to limit the download-speed to simulate and test slower Internet-connections.
Pro’s:
Standalone App (does not require a license)
Opens the built project in the default browser
Can access the current local host or other devices on the network
Option to choose a Default Server port
Download-speed simulation
Common download presets
Optional send No-Caching headers to avoid browser-side caching
Option to send CORS Header
Web Server Log
Can be used to view local files on the device
Works with both Pano2VR and krpano tours
Con’s: None to mention
You can download the Mac or PC version from https://krpano.com/download/
#3 - Pano2VR Integrated Server
Pano2VR includes a local web server built in to the software. It simulates an active web server so you can view your project locally and on other devices on your network. You can also simulate slower connections to see how a project might download and play back.
Pro’s:
Opens the output project in the default browser
Can access the current local host
Other devices on the network can load directly from the server
Option to choose a port or set it to auto
Http and Https
Speed Limit for testing connections
Web Server Log
Works with both Pano2VR and krpano tours
Can be used to view local files on the device
Con’s:
Cannot be used in standalone mode (Pano2VR must be open)
Limited configuration options
Open HTML Output – Selecting this option to enable the integrated web server for testing outputs.
Network access – Keep this selected to ensure that the web server is using the current local host. Deselect this option to allow access to other devices on the network.
Port – Choose your desired port or leave it at auto. The server will use a new port number every time it is restarted or the program is opened. A fixed port number can also be used making it possible to bookmark the page. We suggest using ports 8000 or 8080. For more information on port numbers please see, List of TCP and UDP port numbers.
You can download a trial version of Pano2VR for the Mac, PC or Linux from https://ggnome.com/pano2vr#downloads
For more information on using the Integrated Web Server check out the V7 Documentation
#4 - Apache Web Server
Prior to OS X Mountain Lion the Mac had an easy to access Web Sharing feature running on an Apache web server. The feature provided controls for setting up, using, or disabling Web Sharing and allowed testing of HTML pages prior to moving them to a production web server.
With all subsequent versions of OS X, Apple removed the Web Sharing feature that made sharing a web site or related services a simple point-and-click operation. The Apache web server is still included with the OS, but you can no longer access it from the Mac's user interface. You can, if you wish, use a code editor to manually edit the Apache configuration files, and then use the Terminal application to start and stop Apache.
There are applications such as VirtualHostX that you can purchase, install and use to view HTML files locally. Alternatively you can set up the Apache Web Server using the instructions found here https://discussions.apple.com/docs/DOC-3083
Fortunately the two major Virtual Tour software developers, Pano2VR and krpano, have included localhost Web Servers within their software offerings.
Summary
I hope you have enjoyed the tutorial and it has helped you to achieve the best possible project outcome. If it has please take a second to consider a donation so that I can continue to add more tutorials.