Bug 17607
Summary: | 'java' object not exposed to js | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michael A. Puls II <shadow2531> |
Component: | Java | Assignee: | 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
(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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Robert Blaut
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
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
*** This bug has been marked as a duplicate of bug 15109 ***