Note: although the title of this page remains the same, there is no longer any implication of Java applets involved in running Jmol
- 1 Jmol HTML5 Object (JSmol)
- 2 Installing Jmol objects
- 3 Jmol in Wikis
- 4 Tools for Authoring Jmol Web Pages
- 5 Saving Files from the Jmol Object
Jmol HTML5 Object (JSmol)
Installing Jmol objects
If you only wish to create a web page(s) containing molecular scenes in Jmol, there are easier ways than starting from scratch: see #Tools for Authoring Jmol Web Pages. If you wish to learn how to create web pages containing Jmol from scratch, read on.
Download the Jmol package (either
tar.gz format) and extract/uncompress only the necessary files to the folder of your choice.
Which are those necessary files? Read subsections below.
To use the Jmol object within local web pages, e.g. on the hard disk or on CD, see Jmol Applet Deployment Local for some precautions needed.
For some specific needs, you must use other files; read the sections below about the signed applet.
Inserting Jmol objects into web pages
Forcing the JSmol object to open in a certain language
The JSmol object includes several languages (technically called localizations) for the user interface (pop-up menu). JSmol will open by default with the interface using the language of your operating system (ref.). However, if you need to change this:
- The language in JSmol can be switched anytime, from the pop-up menu, "Language" item near the bottom.
- Or, using the scripting language:
language = "de"(you must use the keyword "language" and the two-letter language code: ca, cs, de, en, es, et, fr, nl, pt, tr, etc.). In a few cases, the language code has 2+2 letters: en_GB, en_US, pt_BR, zh_CN, zh_TW
- To set the language just when the JSmol object is created as the web page loads, use the language parameter of the
Testing different JSmol versions
(This is an advanced feature)
You can force the use of a certain version of JSmol object in any web page (even if that page is not yours), as long as the page was written using the standard, recommended code for inserting JSmol objects. The way to do so is:
On the URL line of the browser, add the following:
(Pending -- this needs verification)
Jmol in Wikis
Tools for Authoring Jmol Web Pages
Jmol.php: easy Jmol insertion into a web page
You can insert a Jmol object into a web page with nothing more than a simple
You don't have to install any Jmol files in your computer or web server.
You don't even need a file with the 3D model; it will be automatically obtained from an appropriate web server.
Note that this way of using Jmol is easily compatible with any environment where you do not control the full source code, like forums, blogs, wikis, content management systems, e-learning environments... In fact, you can email the address and the recipient will see the Jmol object by clicking on the received link.
See Jmol_PHP for details.
Proteopedia's Scene Authoring Tools
Jmol's Export to Web
Saving Files from the Jmol Object
Although this isn't obvious, the molecule that is being shown in JSmol can be saved to local disk unless the model was loaded inline, in which case this technique fails. To do so:
- Open the applet's menu (right-click, Ctrl+click, or click on bottom-right "Jmol" logo).
- Click on the last entry (
- On the submenu that appears, the first entry is the name of the first model loaded. If it says "string" then the model was loaded inline and continuing will result in a "404" resource not found error. If the entry is a file name, then you can continue. If more than one file has been loaded, there will be a line for each on this submenu. Click on the one that you want to open or save. This will bring up another layer of menu options
- Click on the last entry (
View+ name of file)
- Depending on your browser's configuration, the file will be opened in the associated program ("helper application") or you will get an "Open or Save" dialog; choose Save and location in your disk.
- Warning: At least in Windows, modern browsers may detect this action as opening a pop-up window, so it's likely that the pop-up blocker will prevent you from seeing the "Open or Save" dialog. Pay attention to messages and options in your browser to allow pop-ups for the current page. (Such messages often appear as yellow bars at the top of the page, warnings in a toolbar, or hints in the status line at the bottom of the browser window.)
In addition to saving the full model, a part of the molecule can be extracted and saved into MOL format. This is not so straightforward as the former, and is described in the "interactive scripting documentation" (see Jmol home page).