3Dmol.js icon indicating copy to clipboard operation
3Dmol.js copied to clipboard

Displaying 3Dmol output using local .pdb files on html pages

Open paulaberry opened this issue 4 years ago • 3 comments

Description When c&p-ing the code on the page How to Embed a 3Dmol Viewer in an html document, the example works perfectly. However, when replacing data-pdb='2POR' with data-href='/link/to/pdbfiles/myprotein.pdb', the 3Dmol Viewer is not displayed. When just replacing 2POR with /link/to/pdbfiles/myprotein.pdb the webpage is blank as well. Is displaying local .pdb files supported?

paulaberry avatar Dec 14 '21 22:12 paulaberry

data-pdb is for specifying a pdb code. To specify a file use data-href to specify the URL to the file.

dkoes avatar Dec 15 '21 00:12 dkoes

I used data-href but it is still not displaying local .pdb files.

paulaberry avatar Dec 15 '21 00:12 paulaberry

Make sure your URL is correct and check the console for error messages. Here is an example that uses data-href to load a local file: https://3dmol.org/tests/auto/generate_test.cgi?test=test6

Of course "local" in this case means local to the webserver. Javascript can not access arbitrary files on the user's machine - that would be a Very Bad Thing.

dkoes avatar Dec 15 '21 00:12 dkoes