two ideas:

1) ".bin" anywhere in the URL will mark the file as binary

2) If you know that all your files are binary, you could make a tiny
adjustment to the JSmol library. Just add a bit of JavaScript after you
load the library that would modify one or the other  of these:


    Jmol._binaryTypes =
[".gz",".jpg",".png",".zip",".jmol",".bin",".smol",".spartan",".mrc",".pse"];
// mrc? O? others?

  Jmol._isBinaryUrl = function(url) {
      for (var i = Jmol._binaryTypes.length; --i >= 0;)
          if (url.indexOf(Jmol._binaryTypes[i]) >= 0) return true;
      return false;
  }

Bob



On Sat, Jun 1, 2013 at 6:02 AM, Geoffrey Rowland <rowland.ge...@gmail.com>wrote:

> Hi
>
> I have been tinkering with integrating JSmol with the open source
> CMS/ePortfolio system Mahara. https://mahara.org
>
> It's working nicely for text data files (.pdb, .mol, .sdf, .xyz, .cif etc)
> but I'm having problems with binary files, specifically PyMOL Session files
> .pse with Chrome and Internet Explorer 10. Firefox, Opera and Safari work
> fine.
>
> As I understand it, the problem is that Mahara stores files as a number,
> without file extension. However, as JSmol does not usually require file
> extensions to identify file types, they can still be successfully loaded
> into JSmol with, for example:
>
> load "http://localhost/mahara/artefact/file/download.php?file=38&view=8";;
>
> I can also get binary PyMOL session files to load and display with JSmol
> in Firefox, Opera or Safari by appending, say, &ext=.pse to the load
> command, i.e. 'fooling' these browsers that the filename includes .pse (see
> http://wiki.jmol.org/index.php/Jmol_JavaScript_Object#Reading_binary_files
> )
>
> However, this does not work for Chrome or Internet Explorer 10. Chrome
> just crashes, though with Firebug reports:
>
> Error reading file at end of file
> Type Error:Object [object Object] has no method 'addAll'
> for file
> http://localhost/mahara/artefact/file/download.php?file=38&view=8&ext=.pse
> type PyMOL
>
> Have tried a few other things, such as prepending the load with PSE:: to
> try to force binary handling, but without success.
>
> I think I am using jsmol.php correctly. All browsers works fine for the
> dna.pse exemplar at http://chemapps.stolaf.edu/jmol/jsmol/test2.htm,
> /test3.htm, /jsmol.htm etc either at stolaf.edu or copied to my
> localhost. So, I presume it just needs some way of forcing Chrome and IE to
> recognise the PSE files as binary, when held in Mahara.
>
> Any suggestions? Have I overlooked something simple?
>
> Cheers
>
> Geoff
>
>
>
> <http://wiki.jmol.org/index.php/Jmol_JavaScript_Object#Reading_binary_files>
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Chemistry Department
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to