| Issue 580: | Java Applet to JavaScript communication (liveconnect) is not working. | |
| 63 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
Product Version : 0.2.149.27 (1583)
URLs (if applicable) : -
Other browsers tested:
Add OK or FAIL after other browsers where you have tested this issue:
Safari 3: DK
Firefox 3: OK
IE 7: OK
What steps will reproduce the problem?
1. Embed simple java applet with a string setter function in an html page.
2. Write a JS script that tries to set that filed.
3. Run it.
What is the expected result?
Success in setting the String inside the java code.
What happens instead?
Error in JS, claiming the applet does not have the given setter method.
------------
I'm adding a small example of a java file and html file. Works in FF3 and
IE6, not in
Google Chrome.
(Compile with any version you'd like, I tried with java 1.5)
The files should be in the same folder (the .class and .html).
|
||||||||||||||||||||||||||
,
Sep 03, 2008
I also experienced a problem with a page that contains an applet and has javascript routines that are supposed to interact with the applet. From what I could tell when I tested it, the interaction between the applet and the javascript functions are not executing. The applet is responding as it should to input, but the page does not update with the data the applet should be supplying to it. |
|||||||||||||||||||||||||||
,
Sep 04, 2008
Br, In my example the applet is *not* responding to the input, because the functions are not executing. Please look at the example I added and tell me you you get a different result... |
|||||||||||||||||||||||||||
,
Sep 05, 2008
Also seen this with my Java applet at www.j2e.com/new
window.onbeforeunload does work with Chrome in simple javascript.
However in my case it does not. My application is a java application.
In order to stop window closure when the user has edited in the
application area, I have to get javascript to communicate with java. I
do this using the DOM, which works fine in Firefox, IE and Safari. The
following example code fails in Chrome at the DOM call. The script
does not echo the following alert, so it appears that Chrome just
kills the script?
<script language="JavaScript1.2" type="text/javascript">
<!--
//register function with the event handler
window.onbeforeunload = confirmUnload;
function confirmUnload(){
alert("?"); // test we came into this function - we did!
// Call function in javaApplet to see if document has changed.
Function returns "yes" or "no".
var c = document.javaApplet.changed();
alert(c); // This alert never happens with Chrome, window
just closes. Firefox and IE give this alert with correct value.
if (c=="yes")
return 'You have made changes, and they will be lost!';
}
//-->
</script>
|
|||||||||||||||||||||||||||
,
Sep 09, 2008
This problem causes our application not to work properly. This means we can't recommend nore support Chrome as browser, please fix it. |
|||||||||||||||||||||||||||
,
Sep 09, 2008
TiddlyWiki users would like to see this one fixed also. It prevents TiddlyWiki from being able to save. |
|||||||||||||||||||||||||||
,
Sep 09, 2008
My application with applet liveconnect is not working too. My javascript unable to call the method in applet. Please fix it. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Just a "me too" (as a Tiddlywiki user) to increase the visibility of this bug. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Another me too! This is stopping the adoption of Chrome as default since quite a few web apps fail! |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Chrome currently requires the latest Java 6 beta from Sun:http://java.sun.com/javase/downloads/ea/6u10/6u10RC.jsp |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Have you tried Java 6 beta release? http://java.sun.com/javase/downloads/ea/6u10/6u10RC.jsp |
|||||||||||||||||||||||||||
,
Sep 10, 2008
We are using Java 6 beta (update 10) foe our tests. It is with this version that the calls failed. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
I will take a look into it.
Status: Assigned
Owner: f...@chromium.org |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Thanks, If you need any extra information, don't hesitate to ask. Ian |
|||||||||||||||||||||||||||
,
Sep 10, 2008
It turns out a silly mistake, the binding code didn't think Applet element is a plugin element. I made one-line change in the code and the simple test case you provided works fine now. Before I claim this bug is fixed, do you have some more complicated Java Applets on the web that I can test out? |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Feng - have you tried the fix with a TiddlyWiki save yet? Thanks, Chuck |
|||||||||||||||||||||||||||
,
Sep 10, 2008
kittrellbest: can you provide steps to reproduce the problem you had with TiddlyWiki? geofftitmuss: can you also provide steps to reproduce the problem? I didn't see the dialog when I close the window in Safari. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Ok, to test my case. Load www.j2e.com/new&beta Then click on the blank page, and type some text into it eg "j2e in Chrome is really cool" ;-) Then try to close the window. A dialogue should appear asking if you are sure, you will lose changes... |
|||||||||||||||||||||||||||
,
Sep 10, 2008
geofftitmusee: First you need to fix the your website:
document.j2e does not work in Safari and Chrome, you need to change it to window.j2e,
or document.getElementById('j2e');
|
|||||||||||||||||||||||||||
,
Sep 10, 2008
geofftitmuss: other that, I can see window.j2e.changed() returns 'yes' or 'no' properly with my fix. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
You can test on a more complex applet that makes extensive use of LiveConnect at www.upnext.com. Thanks. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
I should add, you'll know it's working if the applet resizes to fit the available width of the screen whenever you change the browser window size. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
geofftitmuss: actually this is a webkit "bug" or not. document.j2e should work, but in your code, <object ...> is not closed by </object>. It works in FF, but not work in Webkit (Safari). I am going to file a bug to WebKit. Thanks for reporting. |
|||||||||||||||||||||||||||
,
Sep 10, 2008
Filed webkit bug about <object> https://bugs.webkit.org/show_bug.cgi?id=20775 radvani, the resize does not work yet. there are other issues. I will take another look. JS code on http://upnext.com is obfuscated. Do you have snippets of JS code that talk to applets? |
|||||||||||||||||||||||||||
,
Sep 10, 2008
The <object> requiring </object> is not a bug - it's following the standard. The only reason FireFox allows it is that Explorer does (along with many other things that should not be allowed) and web-programmers got used to that. Valid HTML always has a </object>, or if you're looking at something like <img src...> then it should end like this: <img src="..." ... />. |
|||||||||||||||||||||||||||
,
Sep 11, 2008
-> actually this is a webkit "bug" or not. document.j2e should work, but -> in your code, <object ...> is not closed by </object>. In my code the <object> is closed by </object>. Look carefully, the <object> line is done by a document.writeln in javascript. the </object> is in the original html. This is done for a reason, my server generates the html with some parameters in it. The javascript is static and reused. Safari on Mac OS is quite happy with with. |
|||||||||||||||||||||||||||
,
Sep 11, 2008
-> document.j2e does not work in Safari and Chrome, you need to change it to
window.j2e,
-> or document.getElementById('j2e');
I have changed my code from document.j2e to document.getElementById('j2e').
My applet now works on Chrome.
document.j2e should have worked and must be a Chrome and Safari(Windows) bug.
thanks for your help.
|
|||||||||||||||||||||||||||
,
Sep 11, 2008
I've tested TiddlyWiki with the latest nightly, and the JavaScript bridge is still not working correctly.
The code in question is:
if(document.applets["TiddlySaver"]) {
var s= String(document.applets["TiddlySaver"].loadFile(javaUrlToFilename(filePath),"UTF-8"));
return s;
}
When I alert document.applets["TiddlySaver"], it comes out as an HTMLAppletElement, and the Java console indicates that the applet is being
loaded and initialised. When I try the code above to invoke a method exposed by the applet, the error I get is:
Uncaught TypeError: Object #<an HTMLAppletElement> has no method 'loadFile'
|
|||||||||||||||||||||||||||
,
Sep 11, 2008
geofftitmuss: document.j2e bug is filed to webkit: https://bugs.webkit.org/show_bug.cgi?id=20775 radvani: http://www.upnext.com seems working on my local build, the map resizes when the window resizes. jeremy.ruston: The code seems fine to me, and it shouldn't throw the exception. Do you have easy reproducible steps? |
|||||||||||||||||||||||||||
,
Sep 11, 2008
Where do we download the latest build to test? thanks |
|||||||||||||||||||||||||||
,
Sep 12, 2008
Yes, you can. Here is a recent build that has the fix: http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/2115/ You can download chrome-win32.zip and extract it. Start Chrome with a parameter like chrome.exe --user-data-dir=c:\foo, so it won't mess up with your default profile. And you can always find the latest build at http://build.chromium.org/buildbot/waterfall/ looking for 'archived build' and click on the [download] below it. |
|||||||||||||||||||||||||||
,
Sep 12, 2008
Thanks for the build info, Here is what we get from our live connect based platform; 1. The JRE loaded with Java Kernel upon plug-in component request from the chrome does not work and throws a cryptic exception from inside java plugin2 code. 2. The offline installation from http://java.sun.com/javase/downloads/ea/6u10/6u10rcDownload.jsp#6u10JREs of JRE runs liveconnect fine with the snapshot build; however, it can not instantiate live connect for the second applet. This means that it does not allow two applets to make a live connection on the same page or from different iframes from the same domain. 3. Our platform is quite complex and works fine with Safari for windows. I can provide a private demo to you to test the liveconnect with it. Just drop a message here I will email demo information to you. thanks Bora |
|||||||||||||||||||||||||||
,
Sep 12, 2008
By the way, the second execution of the scenario I have listed on item 2 has failed with the result of item 1. Here is the cryptic exception I have mentioned. java.lang.Exception: comp is null at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) |
|||||||||||||||||||||||||||
,
Sep 12, 2008
recent build works fine with javagotchis (reloading the given nr in the url)! http://www.javagotchi.com/?1000 thank you and looking forward to the next release... greetinx from germany |
|||||||||||||||||||||||||||
,
Sep 12, 2008
sorry i was by accident in the wrong browser :| same bug with javagotchis: :( java.lang.Exception: comp is null at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) |
|||||||||||||||||||||||||||
,
Sep 13, 2008
Further investigation reveals that there is in fact an initialization problem with the applets in chrome. When the said exception is received, pressing on the refresh button of the chrome loads the applet successfully. Therefore, the second issue I have listed in comment 31 was probably related to this failed initialization attempt of the second applet. How is this handled in webKit? is it really totally different? |
|||||||||||||||||||||||||||
,
Sep 13, 2008
Thanks very much feng, the applet seems to work perfectly in TiddlyWiki now. Your quick response is much appreciated by everyone in the TiddlyWiki community. |
|||||||||||||||||||||||||||
,
Sep 14, 2008
The following still will not load: http://maps.rmlsweb.com/GeoJetElp/sjgeojet.asp?mapName=42&X=-48936082&Y=47782158&address=28282+SW+MOUNTAIN+RD,+97068 Is this the same problem? Thanks |
|||||||||||||||||||||||||||
,
Sep 17, 2008
sorry, guys, I was a bit busy on other stuff in last a few days. @boraertun, a private demo will certainly help, please email to feng @ chromium org To comment 34, do you have a url I can try out? |
|||||||||||||||||||||||||||
,
Sep 17, 2008
@dshehane, I got the same error dialog box in Safari: GeoJet not loaded successfully. Check security settings to enable Java Applet and Javascript. |
|||||||||||||||||||||||||||
,
Sep 17, 2008
>comment 34 http://www.javagotchi.com/?10020 seem to work good now, just enter a number between 0 and 999999 after the questionmark, this parameter will be transferred onload to the applet thanx! |
|||||||||||||||||||||||||||
,
Sep 18, 2008
Should be fixed in 0.2.149.30 according to changelog. http://google-chrome-changelogs.blogspot.com/ |
|||||||||||||||||||||||||||
,
Sep 19, 2008
the Jmol community (jmol.sourceforge.net) is VERY happy to see this working, for example, at http://chemapps.stolaf.edu/jmol/docs/examples-11/new.htm excellent! |
|||||||||||||||||||||||||||
,
Sep 21, 2008
We still cannot get Java to JavaScript execution to work properly in the latest Chromium build. Whenever a script that is invoked from within a Java applet encounters a call to a Java method it produces an evaluation error and the script fails to execute. Can this be fixed also? |
|||||||||||||||||||||||||||
,
Sep 23, 2008
Anyone out there? This is serious! |
|||||||||||||||||||||||||||
,
Sep 25, 2008
Hi everyone, sorry for the delay. I am overwhelmed by other stuff. Amit is our plugin person, and I forwarded all your private messages to him and re- assign the bug to him. I will help fix Java plugin bugs when I have free time. Thanks for reporting, we are not ignoring you.
Owner: a...@chromium.org
Cc: f...@chromium.org |
|||||||||||||||||||||||||||
,
Sep 29, 2008
(No comment was entered for this change.)
Labels: -area-unknown Area-Misc
|
|||||||||||||||||||||||||||
,
Oct 03, 2008
document.applets[] is non-standard. |
|||||||||||||||||||||||||||
,
Oct 09, 2008
document.applets[] is supported in Google Chrome and should work. If someone can provide test cases for these issues then it will be very helpful in resolving them. Thanks! |
|||||||||||||||||||||||||||
,
Oct 10, 2008
I provided a test case to Feng, but here it is again... |
|||||||||||||||||||||||||||
,
Oct 21, 2008
Thanks for the test case. It can be further reduced to:
<html><head><script language="javascript">
function runTest() {
var g = document.scripter.getGraphics();
g.setColor(new java.awt.Color(200, 200, 200));
}
</script>
</head>
<body onload="runTest()">
<applet id="app" code="java.applet.Applet" name="scripter"
width="100" height="100">
</applet>
</body>
</html>
This fails because Chrome doesn't support global Java packages. So it is not possible
to call 'new java.awt.Color(...)' in Chrome.
However, I am looking into the newer way to support this using the following syntax:
'new document.scripter.Packages.java.awt.Color(...)'
New Java plugin enables this syntax and more information about it can be found here: https://jdk6.dev.java.net/plugin2/liveconnect/#PER_APPLET_PACKAGES
Will revisit this later once we have 'Packages' keyword working.
|
|||||||||||||||||||||||||||
,
Oct 29, 2008
Looking at this thread, I'm going to take this out of Area:Misc and put it in Area:WebKit
Labels: -Area-Misc Area-WebKit
|
|||||||||||||||||||||||||||
,
Feb 28, 2009
Is this related to the Bug I posted? http://code.google.com/p/chromium/issues/detail?id=6170 Thanks, Beanie |
|||||||||||||||||||||||||||
,
Mar 02, 2009
Ardent user of tiddlywiki and this is currently preventing me from using it in Chrome. Love the 'application' aspect and waned to set up a standalone tiddlywiki todo. |
|||||||||||||||||||||||||||
,
Mar 02, 2009
From the script it does not look like it using 'java.awt.xxx..." pattern so it is not related. Also, it happens on Safari too so it could be a webkit issue. |
|||||||||||||||||||||||||||
,
May 15, 2009
(No comment was entered for this change.)
Labels: Area-Plugins JavaScript Mstone-2.1 Size-Large
|
|||||||||||||||||||||||||||
,
May 15, 2009
(No comment was entered for this change.)
Status: Available
Owner: --- Cc: a...@chromium.org mbel...@chromium.org |
|||||||||||||||||||||||||||
,
May 22, 2009
(No comment was entered for this change.)
Labels: -mstone-2.1 mstone-3
|
|||||||||||||||||||||||||||
,
May 23, 2009
(No comment was entered for this change.)
Summary: Java Applet to JavaScript communication (liveconnect) is not working.
|
|||||||||||||||||||||||||||
,
May 29, 2009
(No comment was entered for this change.)
Status: Assigned
Owner: a...@chromium.org |
|||||||||||||||||||||||||||
,
Jun 01, 2009
I am not sure if this is related to this but or not, but using the <applet> tag works fine with LiveConnect, but using the <object> tag does not seem to work with LiveConnect. eg. <object name="testObj" type="..." ...>[params]</object> <script language="Javascript"> javaObj = document.testObj; alert(javaObj.someTestMethod()); </script> This code works if <applet> is used instead of <object>. Both work in other browsers like Firefox. Expected result: An alert box featuring some text returned by the Java applet through LiveConnect. Actual Result: Nothing. No code beyond "javaObj.someTestMethod()" runs. Additionally, the developer javascript debugger fails to load on the page. Version: 2.0.172.28 |
|||||||||||||||||||||||||||
,
Jun 01, 2009
jimbo2150: have you tried using getElementById()? It may not be an issue with Java bindings at all. |
|||||||||||||||||||||||||||
,
Jun 01, 2009
Yes, I have tried getElementById(). Oddly enough, in Chrome and Firefox it returns an HTML object, but not the java object. Attempting to call some Java method gives a "that method does not exist" error. |
|||||||||||||||||||||||||||
,
Jun 01, 2009
Right, so this is not related to Java live connect. :) |
|||||||||||||||||||||||||||
,
Jun 05, 2009
(No comment was entered for this change.)
Status: Available
Owner: --- Labels: -mstone-3 Mstone-X |
|||||||||||||||||||||||||||
,
Oct 17, 2009
None of the example on https://jdk6.dev.java.net/plugin2/liveconnect/ work for me. |
|||||||||||||||||||||||||||
,
Oct 20, 2009
We don't ever intend to support LiveConnect in Chrome. The newest version of the Java plugin from Sun removes the need for this, since it uses NPRuntime to allow scripting.
Status: Invalid
|
|||||||||||||||||||||||||||
,
Oct 20, 2009
I am happy with not suppporting LiveConnect but should the examples provided for the new plugin for Sun jvm 1.6 for javascript and Java communication work? The link in comment # 68 is talking about the new plugin and "LiveConnect". None of these examples work in chrome...any plans to support that? |
|||||||||||||||||||||||||||
,
Oct 20, 2009
Also found this bug which shows that none of the java plugin2 LiveConnect tests passing: http://code.google.com/p/chromium/issues/detail?id=3285#c39 |
|||||||||||||||||||||||||||
,
Dec 18, 2009
(No comment was entered for this change.)
Labels: -Area-Plugins Area-Internals Internals-Plugins
|
|||||||||||||||||||||||||||
,
Dec 30, 2009
I've found LiveConnect works as long as the <applet> are a part of the static html document. But if I try something like this LiveConnect stops working. appletinsert = '<applet>...</applet>' document.getElementByID( 'targetdiv' ).innerHTML = appletinsert; LiveConnect calls to the javascript work but not from the javascript back to the applet. Can anyone suggest any alternatives that might allow me to dynamically insert the applet tag into an html element? Thanks. |
|||||||||||||||||||||||||||
,
Feb 21, 2010
jeremy.ruston is incorrect in saying the problem with tiddly wiki is solved. it is not :| the stepts to reproduce the problem: 1. save the two attached files somewhere (they're the latest version of tiddly wiki) 2. open 'empty.html' (an blank tiddly wiki file) with Chrome 3. edit something (click 'edit' in the upper-right side, change something, and click 'done') 4. click 'save changes' in the right panel (a confirmation message will appear that the file was saved) 5. close the file 6. reopen the file - the change made at step 3 is no more... |
|||||||||||||||||||||||||||
| ► Sign in to add a comment | |||||||||||||||||||||||||||