[LON-CAPA-users] Jsmol with Internet Explorer and Safari

Stuart Raeburn raeburn at msu.edu
Mon Nov 9 21:23:17 EST 2015


Bob,

> I've coded up my first problem with Jsmol and it works fine on the latest
> Chrome and Firefox.  But it doesn't work on Internet Explorer 11 or Safari
> (latest).

This issue appears to be specific to the binghamton servers. I am able  
to display an example web page of mine (published public) which uses  
jmol/jsmol:

/res/msu/raeburn/testing/jmol/jsmolwebpage.html

successfully in Safari on a number of LON-CAPA servers in the network,  
apart from the ones in your domain. (I am also able to display that  
resource from servers in your domain if I use Firefox or Chrome).

When I attempt to use Safari to display that page on:
loncapaN.chem.binghamton.edu (N = 2, 3, 5, 6, or 7) two errors are displayed:

(a) A dialog box with the message: "JSmolCore.js: synchronous binary  
file transfer is requested but not available"
and then (if I click "OK") some seconds later:

(b) A dialog box with the message:

Error connecting to server:  
http://your.server.here/jsmol.php?call=getRawDataFromDatabase&database=_&query=http%3A%2F%2Floncapa7.chem.binghamton.edu%2Fres%2Fmsu%2Fraeburn%2Ftesting%2Fjmol%2Fcaffeine.mol&encoding=base64

Looking at the jsmol documentation:
http://wiki.jmol.org/index.php/Jmol_JavaScript_Object

(see: "Reading binary files" section)

I find that jsmol.php will be called if a binary format file (gz, zip,  
pse, etc.) is requested from Safari, Chrome, or MSIE, and a jsmol.php  
file needs to be used to convert the binary data to BASE64 format. The  
documentation states jsmol.php is a "A server-side PHP utility that  
allows a number of functions that can increase the platform and  
browser compatibility of JSmol".

By default http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php will be used.
However, if you modify /home/httpd/html/jmol/Jmol.js by modifying this line:

serverURL: "http://your.server.here/jsmol.php", // required for binary  
file loading (.bin .gz .zip .jpg .png .jmol .smol .spartan .mrc or  
.pse files).

and replace http://your.server.here/jsmol.php with the hostname of  
your server (and an appropriate path) you could use a local jsmol.php  
file, and thereby override the default behavior of jmolInitialize().

You would need to obtain jsmol.php from the jmol binary (from   
http://sourceforge.net/projects/jmol/files/Jmol/Version%2014.2/Version%2014.2.13/Jmol-14.2.13_2015.03.23-binary.zip/download ) because the jmol-loncapa.zip file included in the LON-CAPA 2.11.1 tarball does not include  
it.

What is odd about this is that the caffeine.mol file (MIME:  
chemical/x-mdl-molfile) is not a binary file, and I am able to  
download this text file directly via:  
http://loncapa7.chem.binghamton.edu/res/msu/raeburn/testing/jmol/caffeine.mol

The documentation does say:

'These "extensions" can appear anywhere in a file name to trigger the  
binary access mode. So, for example, if you rename any file to include  
.bin anywhere in its name, that will instruct JSmol to read it as a  
binary file'.

The file name does not contain the extension .bin, but if the URL was  
being examined instead of the file name, then the string ".bin" does  
appear (in .binghamton).


Stuart Raeburn
LON-CAPA Academic Consortium

Quoting Bob Gonzales <rgonzal at binghamton.edu>:

> Hi,
>
> I've coded up my first problem with Jsmol and it works fine on the latest
> Chrome and Firefox.  But it doesn't work on Internet Explorer 11 or Safari
> (latest).  The both complain about the file format.  IE says 'unrecognized
> file format for file xxx' and Safari says it doesn't know how to open the
> binary file.
>
> I'm using .mol files.
>
> I'm invoking the viewer with the following code:
>
> <script src="/adm/jmol/Jmol.js" type="text/javascript"></script>
> <script type="text/javascript">jmolInitialize("/adm/jmol");</script>
> <script type="text/javascript">jmolApplet(150,"background [xFFFFCC]; load
> ../Graphics/type04/$correctMolecularGeometry.mol");</script>
>
> It would be great to get this to work on IE since that is what is available
> on our instructional computers.
>
> Thanks,
> Bob Gonzales



More information about the LON-CAPA-users mailing list