It's a pretty simple solution. Really what the problem is is that both Jmol and MathJax are competing for the AJAX processing. For compatibility with MathJax, make sure:

1) you are using dynamic loading of the applet
    -- no <script> tags that use Jmol.getApplet() within the body
    -- use  $(document).ready() to create all applets

2) then set the jQuery document ready  event to monitor MathJax loading and only start in on the AJAX until that is done. For example:


loadJmol = function() {
  if (!$("#MathJax_Message")[0] || $('#MathJax_Message:contains("Loading")')[0]) {
    setTimeout(loadJmol, 10);
  Info.deferApplet = false;
  Info.deferUncover = true;
  jmol1 = Jmol.getApplet("jmol1", Info)   
  Info.deferApplet = true;
  Info.deferUncover = true;
  jmol2 = Jmol.getApplet("jmol2", Info)   

On Tue, Aug 20, 2013 at 12:12 AM, Gareth Oakes <> wrote:
Hi there,

I'm not sure if this is the correction mailing list or not, but wanted to report an issue with JSmol. We are working on integrating JSmol into a web site which already uses MathJax and we ran into an incompatibility issue. We have a crude workaround but I wanted to explore the root cause.

I have discovered that upon execution of the JSmol getApplet() method, the java2script Clazz system seems to replace the standard Javascript Error object with a copy of java.lang.Error. This causes MathJax to fail because it expects to have the standard Javascript Error object available.

Why are objects in the global Javascript namespace being modified and is there a way to prevent it?

BTW I discovered this in test file "jsmol.htm" which ships with My test environment was Chrome 28.0.1500.95 on Windows XP.

Gareth Oakes

Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
Jmol-developers mailing list

Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN

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