Problem with two MarvinSketch applets on single page.

User 9b0b2c1b48

04-04-2013 14:31:08

I seem to be having a problem whenever two applets are loaded on the same html page, but only if I previously didn't open a page with a single applet in the same browser instance.  The problem occurs in Firefox and Chrome on Ubuntu 12.04 and in Firefox on Windows 7.


 


To see the problem do the following;


1) Close you browser and open a new browser.


2) Open the following page with two applets on at it www.easyochem.com/custom/twoapplets.html.  The two applets will hang.


3) Close you crashed browser and restart it.


4) Open the following page with only one applet on it www.easyochem.com/custom/oneapplets.html.  The applet should start this time.


5) Now open the following page with two applets on it www.easyochem.com/custom/twoapplets.html.  The two applets now fire up.


I'm using the applet tag.  I must be missing someting.  I've tried different combinations of legacy_lifecycle true/false, but it will always hang in a fresh browser if I first try to open two applets on same page.


Thanks


Carl


 

User 870ab5b546

04-04-2013 16:28:39

You can try using the molLoaderFinishedEvent parameter to load the second applet only after the first one is loaded.


This page loads two applets without any problem.  Feel free to use it as a model for what you want to do.

ChemAxon 2c555f5717

08-04-2013 23:31:28

Dear Carl Leblond!


   We could not idetify your problem yet. It is clear that we have some cahing problems. The solution tha was advised by Bob introduces some synchronisation which can help by some sideeffect, but we can not garantee it. Can I ask, why have you changed from our script file to a maunal embeding?


Regards:
Balázs 

User 9b0b2c1b48

10-04-2013 22:36:31

I'm writing question types for Moodle.  In moodle it seems we are required to keep all javascript within YUI.  I've yet to get the marvin.js approach to work.


Currently I call a yui function that inserts the applet tag with (got this from another question type)


var newApplet = document.createElement("applet");

appendChild(newApplet);

My attempts at using following to add script tag have failed;


newScript = document.createElement("script");

appendChild(newScript);

Folks on Moodle.org seem to think I should wrap it into a YUI module, so now I'm studying up on YUI modules.

ChemAxon 2c555f5717

11-04-2013 13:59:24

If you can not use marvin.js on that side you can try to use it on your local machine to generate templates for you. For me it has generated the follwoing code on



<applet width="800" height="600" codebase="./marvin" archive="appletlaunch.jar" code="chemaxon/marvin/applet/JMSketchLaunch">
<param name="legacy_lifecycle" value="true">
<param name="java_arguments" value="-Djnlp.packEnabled=true">
<center><b>YOU CANNOT SEE A JAVA APPLET HERE</b></center>
<param name="codebase_lookup" value="false">
</applet>

<applet width="800" height="600" codebase="./marvin" archive="appletlaunch.jar" code="chemaxon/marvin/applet/JMSketchLaunch">
<param name="legacy_lifecycle" value="true">
<param name="java_arguments" value="-Djnlp.packEnabled=true">
<center><b>YOU CANNOT SEE A JAVA APPLET HERE</b></center>
<param name="codebase_lookup" value="false">
</applet>
 


<embed width="800" height="600" codebase_lookup="false" java_arguments="-Djnlp.packEnabled=true" legacy_lifecycle="true" code="chemaxon/marvin/applet/JMSketchLaunch" archive="appletlaunch.jar" codebase="./marvin" pluginspage="https://java.sun.com/javase/downloads/index.jsp" type="application/x-java-applet;version=1.6"></embed><noembed></noembed><embed width="800" height="600" codebase_lookup="false" java_arguments="-Djnlp.packEnabled=true" legacy_lifecycle="true" code="chemaxon/marvin/applet/JMSketchLaunch" archive="appletlaunch.jar" codebase="./marvin" pluginspage="https://java.sun.com/javase/downloads/index.jsp" type="application/x-java-applet;version=1.6"></embed><noembed>

<center><b>YOU CANNOT SEE A JAVA APPLET HERE</b></center>

</noembed>

 


You could try to use the separate_jvm applet parameter to run your applet s in different JVMs. (In this case they can not block each other.


<APPLET archive="my_applet.jar" code="MyApplet" width="300" height="300">
<PARAM name="java_arguments" value="...">
<PARAM name="separate_jvm" value="true">
</APPLET>


You can read more about this here and you can set this with marvin.js as:


msketch_param("separate_jvm", "true");


I hope, I could help!


Regards:
Balázs