Closed
Bug 120727
Opened 23 years ago
Closed 21 years ago
LiveConnect (JavaScript from Java) fails with some URL-types
Categories
(Core Graveyard :: Java: OJI, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: hans, Assigned: joshua.xia)
Details
(Whiteboard: close)
Hi, I've encountered a problem with executing JavaScript statements from within Java applets. It only occurs when the URL of the page in which the applet is embedded starts with "http://". If the same page is accessed directly from the local hard-drive, using the "file://" URL prefix, then it works perfectly. The following illustrates the problem: (NB: Sorry if it's too detailed - I tried to be thorough) 1. Create a file containing the following HTML code: <html> <body> <form name=myForm> <input type=text name=myText value="TEST FAILED"> </form> <applet code=TestApplet.class codebase=. width=0 height=0 mayscript=true> </applet> </body> </html> 2. Create a file called TestApplet.java containing the following Java code: public class TestApplet extends java.applet.Applet { public void init() { String statement = "document.myForm.myText.value='TEST PASSED';"; netscape.javascript.JSObject.getWindow(super).eval(statement); } } 3. Compile TestApplet.java and copy the class file into the same directory as the HTML file. 4. Access the page from Netscape 6.1 (or greater?) using a URL of the form "file://...". When the applet is loading you should see the text in the text-field change from "TEST FAILED" to "TEST PASSED". So this works. 5. Now place the HTML and Java class file in a directory on a web-server. I used an Apache server on my LAN but I don't suppose that would make any difference. 6. Access the page using a URL of the form "http://...". Now you should observe that the text in the text-field does NOT change. This is wrong, isn't it. It should change to "TEST PASSED".
Reporter | ||
Comment 1•23 years ago
|
||
Further investigation has revealed that it may have to do with the presence or absence of a port-number in URL being accessed. I have placed the test-page described in the initial bug report on web-server that you can access. If you type the URL without a port-number then the test is passed. If, however, you enter a port-number (ie. 80 in this case) then it doesn't work. Please try it: This one works: http://www.psionix.biz/TestApplet.html This one doesn't: http://www.psionix.biz:80/TestApplet.html Hope this helps.
Comment 2•22 years ago
|
||
Reporter, what Mozilla build are you testing? Please always include the buildID with your reports. I'm setting this bug status from Unconfirmed to New.
Status: UNCONFIRMED → NEW
Ever confirmed: true
WFM on Linux(RH8.0)/Windows2000 mozilla1.2 with JRE1.4.1_01. Both http:// or http://...:80 works fine. Reporter: Please try latest JRE and latest mozilla.
Assignee | ||
Comment 5•21 years ago
|
||
->wfm
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•