Bug 17607

Summary: 'java' object not exposed to js
Product: WebKit Reporter: Michael A. Puls II <shadow2531>
Component: JavaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: andersca, ap, webkit
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
URL: javascript:alert(java.lang.System.getProperty(%22java.version%22))%3B

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.