I am having trouble returning arrays of strings from a Java applet to JavaScript on Safari 3.1.2. It works fine on Firefox 3.0.1. Here's the documentation on how it's supposed to work: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:Data_Type_Conversions:JavaScript_to_Java_Conversions http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:Data_Type_Conversions:Java_to_JavaScript_Conversions Here's are two simple files demonstrating the problem. Compile test19.java with javac test19.java. Under firefox, you will see two diagnostic alerts followed by "Success!" On Safari the diagnostics will be obviously wrong and then the script will halt. test19.html: <html> <head> <title>tests whether applets can return string arrays</title> </head> <script type="text/javascript"> function clicker () { var arr; arr = document.test19.test (); alert (typeof arr); alert (arr.toString ()); if (arr[0] == "foo" && arr[1] == "bar") alert ("success!"); else alert ("failure!"); } </script> <body> <button onclick="clicker ()">Write Config</button> <applet name="test19" code="test19.class" width="1" height="1" mayscript></applet> </body> </html> test19.java: import java.applet.Applet; public class test19 extends Applet { public void init () { } public void start () { } public void stop () { } public void destroy () { } public String [] test () { String [] ret = new String[2]; ret[0] = "foo"; ret[1] = "bar"; return ret; } }
Created attachment 22490 [details] html file for testcase
Created attachment 22491 [details] java file for testcase