Marvin Applet problems with jdk 1.5 and <object> tag

User dfeb81947d

22-11-2005 16:28:57

Dear Support,





I'm using InternetExplorer as Web Browser and Marvin 4.0.3


I found a problem with marvin applet and JDK 1.5 when using the tag <OBJECT> to draw the applet.





I wanted to draw an applet according to a javascript command that add a molecule inside (cf code below and html example).





When using JDK 1.4.2 everything is working fine.


When using JDK 1.5 and <APPLET> tag there is no problem.


But with <OBJECT> Internet Explorer is frozen.





(see example attached below)





Here is the code that froze IE when <OBJECT> is used:


Code:
function displayForms(type) {


   document.getElementById("divViewer").style.visibility='hidden';


   document.getElementById("divViewer").style.display='none';


   var str = "";


   var i = 0;


   i = type * 1;


   switch (i) {


      case 1:


         str =    "<applet NAME='MSketch' CODEBASE='marvin' ARCHIVE='marvin.jar' CODE='MSketch' WIDTH=460 HEIGHT=380>"+


            "</applet>";


         break;


      case 2:


         str =    "<object CLASSID='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' width='500' height='500' NAME='MSketch'>"+


            "<param NAME='codebase' VALUE='marvin'>"+


            "<param NAME='archive' VALUE='marvin.jar'>"+


            "<param NAME='code' VALUE='MSketch'>"+


            "<param NAME='scriptable' VALUE='true'>"+


            "</OBJECT>";


         break;


      default:


         str =   "Unknown Viewer";


   


   }


   document.getElementById("divViewer").innerHTML=str;


   document.getElementById("divViewer").style.visibility='visible';


   document.getElementById("divViewer").style.display='block';


   if (i==1 || i==2) {document.getElementById("MSketch").setMol(document.getElementById("MolTxt").value);}


}






We use hardcode <APPLET> and <OBJECT> to identify the problem.


In our application we always use marvin.js.


but in that case it failed with JDK 1.5.0 and works with JDK 1.4.2





A question is: Can we use all the time <APPLET> tag to draw the applet under IE 5.5 + ?


If we use the <applet> tag it would solve all the problem and we won't have to use marvin.js to draw the applet.





Is it possible?





Thank you for your help.


Warmest regards


Jacques

ChemAxon 7c2d26e5cf

23-11-2005 21:01:58

Quote:
A question is: Can we use all the time <APPLET> tag to draw the applet under IE 5.5 + ?


If we use the <applet> tag it would solve all the problem and we won't have to use marvin.js to draw the applet.
Yes you can use the applet tag in IE.


If you use only the AWT version of the Marvin applets, the usage of the <applet> tag is the simplest way.





If there is no Java Plugin on the machine, IE will use Microsoft Java (which is compatible with Sun Java 1.1). If Java Plugin is installed, IE will use it in every cases (both <applet> and <object>) unless the "Use JRE 1.5.0_04 for applet" checkbox is switched off on the Advanced panel in the "Internet Options" menu of IE. In this case, the <applet> tag launches the Microsoft Java. In this case, the <object> tag uses Sun's Java Plugin.

User dfeb81947d

24-11-2005 08:42:26

Dear Tamas,





Thank you for your answer.


But I still have a question:
Tamas wrote:
If you use only the AWT version of the Marvin applets, the usage of the <applet> tag is the simplest way.
Can't we use the swing version with the <applet> tag?


If internet explorer got sun java plugin (jdk 1.4.2 or above) it shouldn't be a problem to use in IE.


We have an application whose requirement is JDK 1.4.2 or above so we are sure that the client would have this plugin installed and functionnel.





Thank you for confirming that I can use <applet> with IE and swing if I'm sure that jdk 1.4.2 is installed.





Best Regards


Jacques

ChemAxon 7c2d26e5cf

24-11-2005 11:59:02

Quote:
We have an application whose requirement is JDK 1.4.2 or above so we are sure that the client would have this plugin installed and functionnel.
In this case, you can use calmly the Swing version of the Marvin Applets with the <applet> tag.

ChemAxon 7c2d26e5cf

24-11-2005 13:24:43

You can force marvin.js to always use the <applet> tag and load the Swing version of Marvin. You have to specifies only the proper parameters in the URL:


http://www.chemaxon.com/marvin/doc/dev/examples-sketch1.1?jvm=builtin&gui=swing


If you don't want to write parameters in the URL, there is an alternative solution:


Code:
<script language="JavaScript" src="marvin.js"></script>


<script language="JavaScript">


marvin_jvm0="builtin"


marvin_gui0="swing"


msketch_begin(".", 400,300);


msketch_end();


</script>

User dfeb81947d

24-11-2005 13:33:13

Dear Tamas,





Thank you very much for those informations.


Is the problem I talked at the beginning is a bug from jdk1.5.0, innerHTML and <object> or a problem from the way I implement it?

ChemAxon 7c2d26e5cf

29-11-2005 01:23:24

Quote:
Is the problem I talked at the beginning is a bug from jdk1.5.0, innerHTML and <object> or a problem from the way I implement it?
It's not an easy question.


Your code has seemed to be good but it is only a part of your example. Without a running example, deciding of this question is very hard. There are several opportunity:


1. A platform specific JRE bug.


2. A bug in JavaScript. (It is imaginable to link to iframe.) Refering to an applet from JavaScript is not always easy.





If your example runs fine with other Java versions (e.g.: 1.4.2), the above problem may be a JRE specific bug. If it is a bug, there can be a small chance to find a workaround for this problem. But I have not got idea how you can debug it.

User dfeb81947d

29-11-2005 08:45:33

Thank you for your answer.


I solve the problem using <applet> tag instead of object in that case.


Thank you very much.