Difference between revisions of "Troubleshooting/Local Files"

From Jmol
Jump to navigation Jump to search
(Safari in MacOS)
(moving local file access tricks to Troubleshoot sction)
Line 1: Line 1:
= Accessing J(S)mol-containing webpages in local disk =
+
= Accessing J(S)mol-containing webpages in local disk, or loading models from local files =
  
== Safari in MacOS ==
+
== MacOS ==
 +
 
 +
=== Safari ===
  
 
'''Symptom''': trying to load an html file with JSmol/Java in Safari. The applet tries to load but then fails.  
 
'''Symptom''': trying to load an html file with JSmol/Java in Safari. The applet tries to load but then fails.  
Line 9: Line 11:
  
 
'''Caveat''': when models in binary-format files are to be loaded, Safari may fail in any case for local files.
 
'''Caveat''': when models in binary-format files are to be loaded, Safari may fail in any case for local files.
 +
 +
=== Chrome ===
 +
A command entered in the terminal allows to start up MacOS Chrome so that JSmol runs from local files:
 +
open /Applications/Google\ Chrome.app --args --allow-file-access-from-files
 +
(Make sure an instance of Chrome is not active when you issue that command.)
 +
 +
There is possibly a way to write an AppleScript to do this in one fell swoop.
 +
 +
== Windows ==
 +
 +
=== Firefox ===
 +
You will be able to read both binary and text files locally. Please enter <code>about:config</code> in the url address slot and then set <code>security.fileuri.strict_origin_policy false</code>.
 +
 +
=== Chrome ===
 +
If you need to open local files, start Chrome using the command-line flag <code>--allow-file-access-from-files</code>. Beyond that, same as for MSIE/Windows below.
 +
 +
=== MSIE ===
 +
It is '''not''' possible to load local '''binary''' files into JSmol/HTML5 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 the Jmol object or files loaded using "?", which use the HTML5 FileReader object. That method reads binary files without a problem.

Revision as of 15:51, 6 September 2014

Accessing J(S)mol-containing webpages in local disk, or loading models from local files

MacOS

Safari

Symptom: trying to load an html file with JSmol/Java in Safari. The applet tries to load but then fails.

Solution: Safari > Preferences > Advanced > check the Show Develop menu in menu bar option.
In the resulting Develop toolbar drop-down, check the Disable Local File Restrictions option.

Caveat: when models in binary-format files are to be loaded, Safari may fail in any case for local files.

Chrome

A command entered in the terminal allows to start up MacOS Chrome so that JSmol runs from local files:

open /Applications/Google\ Chrome.app --args --allow-file-access-from-files

(Make sure an instance of Chrome is not active when you issue that command.)

There is possibly a way to write an AppleScript to do this in one fell swoop.

Windows

Firefox

You will be able to read both binary and text files locally. Please enter about:config in the url address slot and then set security.fileuri.strict_origin_policy false.

Chrome

If you need to open local files, start Chrome using the command-line flag --allow-file-access-from-files. Beyond that, same as for MSIE/Windows below.

MSIE

It is not possible to load local binary files into JSmol/HTML5 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 the Jmol object or files loaded using "?", which use the HTML5 FileReader object. That method reads binary files without a problem.

Contributors

AngelHerraez