Today many web-browsers have several restrictions when running interactive content locally.
'Locally' means when opening a html file directly from the local file-system in the browser.
In the browsers address bar local files can be identified by their file:// url.
When trying to run a local html file, the browser might restrict scripted access to other local files.
And because of this dynamically loading xml, js or image files might be not possible.
A localhost server is an application that runs a web-server locally on the system and
provides access to the local files by http:// or https:// addresses.
This way the file access is the same as when running online on a web-server.
This has also the advantage that other systems and devices in the same local networks (e.g. mobile devices in the same wifi)
could also access the files by using the localhost server address.
krpano includes two special and easy-to-use localhost server applications.
One GUI application and one command-line application. More information here:
krpano Testing Server
It would be possible to change the browsers settings to allow local file access, but as this would affect the whole browser
and all pages, this is not generally recommended and should be only used for testing.
Firefox
Before Firefox 68:
Notthing todo in this case, that browser is allowing access to the local files in the same folder as the origin html file by default.
There are tools like NW.js
or Electron available that allow building standalone Desktop applications
that run webcontent. Especially NW.js is easy to setup, so here example instructions for it:
Another and very special way to bypass the local-file-access restrictions from the browsers would be embedding / inlining ALL
files directly into the html file itself. That means the xml files, plugin js files and the images, all inside one (and probably large) html file.
This make only sense for very small projects of course - no multi-resolution or big tours.
Technically this is possible by using DATA-Urls and base64-encoded files to inline the files.
The core krpano.js file can be keep an external file (but inlining would be possible too)
and the main xml file itself can be added directly without base64-encoding as script tag into the html file.
Here a full example html file (without the actual base64-encoded images, that would be too large):