JS Loading Error - JSME Instance Named as "jsme"


Why I am getting the JavaScript file loading error, if I name the JSME Instance Named as "jsme"?

✍: FYIcenter.com


"jsme" is used in JSME JavaScript code for another object. If you use it to name your new JSME object, it will override the other object and cause JavaScript loading errors.

1. Follow the previous tutorial to install JSME on your Web server.

2. Create a new HTML document, editor-error.html, with JSME object named as "jsme".

<title>My JSME Editor - .js Loading Error</title>
<script type="text/javascript" src="/jsme/jsme.nocache.js"></script>
  function jsmeOnLoad() {
    // naming JSME object as "jsme" causing problems
    jsme = new JSApplet.JSME("jsmeID", "380px", "340px");
<p>Hello, please try the JSME molecule editor below:</p>
<div id="jsmeID"></div>

3. Copy editor-error.html to the Apache Web server where JSME was installed:

fyicenter$ sudo cp editor-error.html /var/www/html/jsme

4. Test JSME editor page on the Apache Web server by opening "http://localhost/jsme/editor-error.html" URL in a Web browser.

5. Select the "benzene ring" icon from the JSME editor menu and click a location inside the editor. You see a benzene ring molecule created.

6. Select the "export & import" icon from the menu and select "Copy as SMILES". You see nothing displayed.

7. Open browser's JavaScript Console window. For example, select "Develop > Show JavaScript Console" menu on Safari. You see a number of JavaScript loading errors:

Failed to load resource: ... http://localhost/jsme/undefineddeferredjs/....js

To fix the problem, modify "editor-error.html" and rename the JSME object with "jsmeObj" instead of "jsme"./


Migrate JME Applet to JSME JavaScript

Loading JSME JavaScript in "body"

JSME JavaScript API

⇑⇑ JSME Tutorials

2020-05-18, 922🔥, 0💬