msketch IE error

User aed4f53879

27-09-2011 18:14:30

The html below works fine in netscape but gives this error in IE8 immediately but "Click Me" works OK


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Tue, 27 Sep 2011 18:07:37 UTC


Message: Object doesn't support this property or method
Line: 9
Char: 3
Code: 0
URI: file:///C:/Documents%20and%20Settings/tj.ROADBEAR/Desktop/x.html


-------------


<html>
<head>
<title>Template Editor</title>
 
    <script LANGUAGE="JavaScript1.1" SRC="http://www.chemaxon.com/marvin/marvin.js"></script>
    <script>
    function atest(element) {
        var medit=document.getElementById(element);
        medit.setMol("C1CCNC1O");
    }
</script>
</head>

<body>
    
   <script language='JavaScript'>
   phenol = 'c1ccccc1O';
   msketch_name = 'MrvMOLFILE';
   msketch_begin("http://www.chemaxon.com/marvin/", 500, 500);
   msketch_param("autoscale", "true" );
   msketch_param("mol", phenol);
   msketch_end();
   atest('MrvMOLFILE');
</script>
<a href="javascript:atest('MrvMOLFILE')">Click me</A>

</body>
</html>

ChemAxon 7c2d26e5cf

30-09-2011 14:46:48

I assume that the lack of the webserver causes the problem.


We recommend to use our applets via webserver (http or https protocol).
We test and optimize them to remote access (via http and https protocol). We do not support
applet usage without webserver.


I have uploaded your example into my webserver and tried to open it on a Windows XP machine with the referred browsers. I could not find any error by running of the applet.


My test environment is:


Windows XP Professional SP3


Java Plugin 1.6.0_25


Firefox 3.6.12 and IE8.0.6001.18702


Please take care that unexpected error may occur if applet page is opened directly from the file system.  Java uses different classloader in this case than by remote access.


I suggest you try your example from a web server.

User aed4f53879

04-10-2011 23:19:20

Thanks for your reply Tamas, but  I'm still having a problem.  I've been using my own webserver all along but change the example to use chemaxon.com/marvin.js since you would not have access to my server.  So, this code works in netscape but give an error in IE8.  Line 10 is attempting to call setMol


The html resides on the same server.


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Tue, 4 Oct 2011 23:12:35 UTC


Message: Object doesn't support this property or method
Line: 10
Char: 3
Code: 0
URI: http://vmubuntu/~tj/x.html



<html>



<head>



<title>Template Editor</title>







<script LANGUAGE="JavaScript1.1" SRC="http://vmubuntu/marvin/marvin.js"></script>



<script> 



function atest(element) {



//var medit=document.getElementById(element);



var medit=document[element];



if (medit) medit.setMol("C1CCNC1O");



}



function clear(element) {



//var medit=document.getElementById(element);



var medit=document[element];



if (medit) medit.setMol("");



}



 </script>



</head>



 



<body>







<script language='JavaScript'> 



phenol = 'c1ccccc1O';



msketch_name = 'MrvMOLFILE';



msketch_begin("http://vmubuntu/marvin/", 500, 500);



msketch_param("autoscale", "true" );



//msketch_param("mol", phenol);



msketch_end();



atest('MrvMOLFILE');



 </script>



<a href="javascript:atest('MrvMOLFILE')">Load</A>



<a href="javascript:clear('MrvMOLFILE')">Clear</A>



</body>



</html>

ChemAxon 5433b8e56b

05-10-2011 01:34:21

Hi,


unfortunatelly i do not have an IE8 to test, but i can reproduce it even with IE9.


I have investigated such an issue as i remember more than a year ago, the main cause is interesting, but we only had assumptions on it. We find that if the call for the applet object is in the same script element than the creation of the applet, or if the call for the applet is after that script element in an other, but before any html element, then internet explorer runs the call before the applet object is initialized, independently from the fact that the the result of document.getElementById() is not null in that point, the object is not in a constructed state, and do not have any of the methods. As you can see in our example we also call applet methods from a different script tag in the end of the html content to avoid the synchronization issue we suspect inside IE. In FF it has worked that time also, and after making this modification it started to work with IE too.


I hope this will help, please inform us if moving the call of the atest method to the end of the body or at least after the first 'a' element solves the problem or not.


Regards,
Istvan