The file is available and everyone has permission to open/download it but JSMol can't recognize it. The error disappears and JSMol works fine if I put the file within the same server where I host JSMol.
Am I doing something wrong? Because it can load the very same PDB file from PDB's website (http://www.rcsb.org/pdb/files/2Q7M.pdb). I checked mimetypes for each and they are the same:
In [4]: import mimetypes
In [5]: mimetypes.guess_type("http://www.rcsb.org/pdb/files/2Q7M.pdb")
Out[5]: ('chemical/x-pdb', None)
In [6]: mimetypes.guess_type("http://storage.evias.s3.amazonaws.com/2Q7M.pdb")
Out[6]: ('chemical/x-pdb', None)
In [7]:
What could be wrong? I'd appreciate any help
Thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But not that in this case AJAX is using an relay server (Info.serverURL)
which in my case goes to St. Olaf. Perhaps you have not got that set up.
The issue is that the amazon storage site does not allow cross-domain AJAX
calls. They are missing the required header:
access-control-allow-origin: *
So JSmol has to use a call to a server that allows that.
Bob
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the
remote resource at http://storage.evias.s3.amazonaws.com/2Q7M.pdb. (Reason:
CORS header 'Access-Control-Allow-Origin' missing).
Retrieving data...
MEMBRANE PROTEIN, LIPID TRANSPORT 07-JUN-07 2Q7M
CRYSTAL STRUCTURE OF HUMAN FLAP WITH MK-591
found biomolecule 1: A, B, C
found biomolecule 2: D, E, F
*script ERROR: TypeError: JU.PT.isAI is not a function *
[I see the structure loaded on your site]
This indicates that some of the .js files on your system are from an
earlier version of JSmol than the one used to load the file. I recommend
re-uploading all the jsmol/j2s and jsmol/js files.
And I still get the same error. I saw it works for you but do you do
something else to make it work? Is what I do wrong? You can see the error
here as well: http://evias.koding.io/tr/vst/receptors/4/
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
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
I'm trying to load a remote file in Amazon AWS S3 storage but it gives me following error:
The file is available and everyone has permission to open/download it but JSMol can't recognize it. The error disappears and JSMol works fine if I put the file within the same server where I host JSMol.
Am I doing something wrong? Because it can load the very same PDB file from PDB's website (http://www.rcsb.org/pdb/files/2Q7M.pdb). I checked mimetypes for each and they are the same:
What could be wrong? I'd appreciate any help
Thanks in advance
I had no problem with that in JSmol on my pages, either locally or using
http://chemapps.stolaf.edu/jmol/jsmol/jsmol.htm
See, for example:
http://chemapps.stolaf.edu/jmol/jsmol/simple.htm?load%20load%20http://storage.evias.s3.amazonaws.com/2Q7M.pdb
But not that in this case AJAX is using an relay server (Info.serverURL)
which in my case goes to St. Olaf. Perhaps you have not got that set up.
The issue is that the amazon storage site does not allow cross-domain AJAX
calls. They are missing the required header:
access-control-allow-origin: *
So JSmol has to use a call to a server that allows that.
Bob
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
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
Thanks for your reply Bob
I actually set the serverURL but it wasn't an absolute path so for now I set it directly to St. Olaf's: http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php
Here is how I do my JS:
And followed by (an external JS added to after above HTML):
And I still get the same error. I saw it works for you but do you do something else to make it work? What do I do wrong?
Last edit: Gungor Budak 2015-08-10
Your error is indeed the cross-domain issue:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the
remote resource at http://storage.evias.s3.amazonaws.com/2Q7M.pdb. (Reason:
CORS header 'Access-Control-Allow-Origin' missing).
Try removing the "async" in your load command:
load "http://storage.evias.s3.amazonaws.com/2Q7M.pdb"
instead of
load async "http://storage.evias.s3.amazonaws.com/2Q7M.pdb"
The "async" option is not available when the server does not allow
cross-domain access, it turns out. I had not realized that.
BTW -- I think you have some sort of mix of files on your server. I got
this error when I loaded the file into your page that way:
[opened the Jmol JavaScript Console]
$cache clear
$set zoomlarge false;;;zap;set echo middle center;echo Retrieving
data...;load "http://storage.evias.s3.amazonaws.com/2Q7M.pdb"
Retrieving data...
MEMBRANE PROTEIN, LIPID TRANSPORT 07-JUN-07 2Q7M
CRYSTAL STRUCTURE OF HUMAN FLAP WITH MK-591
found biomolecule 1: A, B, C
found biomolecule 2: D, E, F
*script ERROR: TypeError: JU.PT.isAI is not a function *
[I see the structure loaded on your site]
This indicates that some of the .js files on your system are from an
earlier version of JSmol than the one used to load the file. I recommend
re-uploading all the jsmol/j2s and jsmol/js files.
On Sun, Aug 9, 2015 at 10:07 AM, Gungor Budak gungorbudak@users.sf.net
wrote:
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
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
Thank you ver much Bob. I re-uploaded the files and didn't use
Jmol.loadFile(myJSmol, path);
but used
script += "load " + path;
To get rid of that "async" (I gues Jmol.loadFile() puts it by default or there is an option to disable it but I don't know)
Now it works!
Great. I have also fixed the LOAD ASYNC problem.
On Mon, Aug 10, 2015 at 3:52 AM, Gungor Budak gungorbudak@users.sf.net
wrote:
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
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
How did you solve it? Shall I update my JSmol?
I was experimenting SYNC way of getting data but it's super slow and it shows blank div for 10 seconds which is annoying
I found out we can set up CORS like this and now I can load files using Jmol.loadFile()
Go to your S3 bucket properties, and under "Permissions", click on "Add CORS Configuration". Paste this in:
from https://www.caktusgroup.com/blog/2014/11/10/Using-Amazon-S3-to-store-your-Django-sites-static-and-media-files/