Difference between revisions of "JSmol Deployment Local"
AngelHerraez (talk | contribs) (remove obsolete details) |
AngelHerraez (talk | contribs) (updates to remove methods for Java applet) |
||
(25 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | This page | + | This page summarizes some advice on how JSmol within web pages can be used to work from a local disk (<code>file://</code> protocol), instead of from a web server (<code>http://</code> protocol). |
− | |||
− | a web server. | ||
+ | This section is in relation to JSmol, versions 14 and later, particularly. It only relates to HTML5 file access, and only to files loaded using script commands such as <code>load</code> and <code>script</code>. | ||
− | + | Note that you can prompt the page visitor for a local file by using the Jmol script command <code>load ?</code> or a URL using <code>load <nowiki>http://?</nowiki></code>. | |
− | == | + | == Specific browser considerations == |
− | |||
− | == | + | === Firefox / Windows === |
− | |||
− | + | You will be able to read both binary and text files locally, but it is necessary to change the default setting: | |
+ | *navigate to <code>about:config</code>, find the <code>security.fileuri.strict_origin_policy</code> entry and set it <code>false</code>. | ||
− | + | Despite this, there may be occasions where access fails with errors, depending of the folder location of files composing the page and the JSmol library. (No certain description of setups that fail has been found yet) | |
− | + | === Chrome / Windows === | |
− | + | The old method of starting Chrome using the command-line flag <code>--allow-file-access-from-files</code> for local file access is no longer possible. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | The only likely solution if you wish to use Chrome is to set-up a local web server (read below). | ||
− | + | It is '''not''' possible to load local '''binary''' files from standard script commands. That is, no direct file reading with any of the following in their names: | |
+ | .bin .gz .jmol .jpg .map .mrc .omap .png .pse .smol .spartan .zip | ||
− | + | This does not apply to files drag-dropped onto JSmol or files loaded using "?", which use the HTML5 FileReader object. That method reads binary files without a problem. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | === Edge / Windows === | ||
− | + | Situation is the same as for Chrome (pending confirmation) | |
− | + | === Opera / Windows === | |
− | + | to-do | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | === Firefox / Mac === | ||
+ | to-do | ||
− | == | + | === Chrome / Mac === |
− | + | to-do | |
− | + | === Safari / Mac === | |
− | + | to-do | |
− | You | + | == Using a local web server == |
+ | Several packages are available that will install a local server in your system. You will then be able to access your local pages and molecule files by activaning such server and access the pages via <code>localhost:</code> or <code><nowiki>http://127.0.0.1/</nowiki></code> protocols. | ||
− | + | This removes any limitations in accessing files. Note that for binary files, at least with some browsers, you need to configure the <code>serverURL</code> item in the [[Jmol_JavaScript_Object/Info#Files_and_paths|<code>Info</code> variable]] to use the PHP filter, likely from the same server. | |
+ | As an easier alternative, there seems to be some extensions for the Chrome browser that will act as local server. Compatibility with latest Chrome security policies has not been checked. | ||
+ | == Legacy documentation == | ||
+ | Mainly involving use of Jmol Java Applets in web pages (not supported by current web browsers) | ||
− | + | See the [[Special:PermanentLink/8397|old version of this page]]. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 11:52, 11 August 2025
This page summarizes some advice on how JSmol within web pages can be used to work from a local disk (file://
protocol), instead of from a web server (http://
protocol).
This section is in relation to JSmol, versions 14 and later, particularly. It only relates to HTML5 file access, and only to files loaded using script commands such as load
and script
.
Note that you can prompt the page visitor for a local file by using the Jmol script command load ?
or a URL using load http://?
.
Contents
Specific browser considerations
Firefox / Windows
You will be able to read both binary and text files locally, but it is necessary to change the default setting:
- navigate to
about:config
, find thesecurity.fileuri.strict_origin_policy
entry and set itfalse
.
Despite this, there may be occasions where access fails with errors, depending of the folder location of files composing the page and the JSmol library. (No certain description of setups that fail has been found yet)
Chrome / Windows
The old method of starting Chrome using the command-line flag --allow-file-access-from-files
for local file access is no longer possible.
The only likely solution if you wish to use Chrome is to set-up a local web server (read below).
It is not possible to load local binary files from standard script commands. That is, no direct file reading with any of the following in their names:
.bin .gz .jmol .jpg .map .mrc .omap .png .pse .smol .spartan .zip
This does not apply to files drag-dropped onto JSmol or files loaded using "?", which use the HTML5 FileReader object. That method reads binary files without a problem.
Edge / Windows
Situation is the same as for Chrome (pending confirmation)
Opera / Windows
to-do
Firefox / Mac
to-do
Chrome / Mac
to-do
Safari / Mac
to-do
Using a local web server
Several packages are available that will install a local server in your system. You will then be able to access your local pages and molecule files by activaning such server and access the pages via localhost:
or http://127.0.0.1/
protocols.
This removes any limitations in accessing files. Note that for binary files, at least with some browsers, you need to configure the serverURL
item in the Info
variable to use the PHP filter, likely from the same server.
As an easier alternative, there seems to be some extensions for the Chrome browser that will act as local server. Compatibility with latest Chrome security policies has not been checked.
Legacy documentation
Mainly involving use of Jmol Java Applets in web pages (not supported by current web browsers)
See the old version of this page.