RESOLVED DUPLICATE of bug 15109 17607
'java' object not exposed to js
https://bugs.webkit.org/show_bug.cgi?id=17607
Summary 'java' object not exposed to js
Michael A. Puls II
Reported 2008-02-29 08:34:08 PST
(Safari 3.1.525.9) In JS with Java installed, you should be able to get the Java version by doing: alert(java.lang.System.getProperty("java.version")); This fails because 'java' is not exposed to js. Works fine in Opera and FF.
Attachments
Robert Blaut
Comment 1 2008-03-02 02:56:41 PST
It's by design. You cannot call Java directly from javascript. First you should create an applet on the page. After that you can use LiveConnect to call methods from the applet using JavaScript. This *proper* method works fine in Webkit. Check this page to read how to do it: http://www.whatscookin.com/staff/mattd/articles/jre-detection.html
Michael A. Puls II
Comment 2 2008-03-02 05:31:10 PST
Thanks. I was referring to < http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Packages > and < http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:java >. For example: <script> (function() { var theOwner = new java.awt.Frame(); var theWindow = new java.awt.Dialog(theOwner); theWindow.setSize(350, 200); theWindow.setTitle("Hello from Opera and Firefox"); theWindow.setVisible(true); theWindow.show(true); setTimeout(function() { theWindow.dispose(); }, 5000); })(); </script> (In reply to comment #1) > It's by design. O.K., this is invalid then.
Alexey Proskuryakov
Comment 3 2010-02-23 16:03:41 PST
*** This bug has been marked as a duplicate of bug 15109 ***
Note You need to log in before you can comment on or make changes to this bug.