Closed
Bug 535024
Opened 16 years ago
Closed 16 years ago
Cannot Invoke Java Applet Method via JavaScript
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: ckemp, Unassigned)
Details
Attachments
(1 file)
|
2.10 KB,
application/zip
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
This same Applet works just fine in MS IE but totally fails in Firefox.
Running the following code in Microsoft IE, it runs fine; in Firefox, it does not. The code is 'straight vanilla' code and shouldn't cause any hiccups, but it does. I've also included the Java Applet code for evaluation; it too is 'straight vanilla' code. Anyone one have any ideas as to why it runs in IE and not Firefox?
-----------------------
HTML CODE START
-----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="cssFiles/pbXpWkr.css" rel="stylesheet" type="text/css" />
<title>Controller Page</title>
<script language="JavaScript" type="text/javascript">
// ONUNLOAD CALL APPLET METHOD WITH PASSED VALUE
function htmlPageTermination() {
var _app = navigator.appName;
var appletNameIs = document.getElementById('pbXpWkr_FF');
if (_app == 'Netscape') { document.all.pbXpWkr.htmlTerminating("WOW"); }
if (_app == 'Microsoft Internet Explorer') { document.all.pbXpWkr.htmlTerminating("WOW"); }
}
</script>
</head>
<body>
<!-- HTML ELEMENTS START -->
<div class="controllerDiv">
<table width="100" border="1">
<tr>
<td><input name="button_1"
id="button_1"
type="button"
onClick="htmlPageTermination();"
value="New Page" /></td>
</tr>
</table>
</div>
<!-- HTML ELEMENTS END -->
<!-- JAVA APPLET START -->
<div>
<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
id="pbXpWkr"
name="pbXpWkr"
width="1"
height="1"
type="application/x-java-applet;version=1.4">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4" />
<PARAM NAME="code" VALUE="pbXpWkrPackage.pbXpWkr.class" />
<PARAM NAME="mayscript" VALUE="true" />
<COMMENT>
<EMBED
id="pbXpWkr_FF"
name="pbXpWkr_FF"
width="1"
height="1"
mayscript="true">
<NOEMBED>No Java Support.</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
</div>
<!-- JAVA APPLET END -->
</body>
</html>
-----------------------
HTML CODE START
-----------------------
.......................................................................................................
----------------------
JAVA CODE START
----------------------
package pbXpWkrPackage;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.swing.*;
import netscape.javascript.*;
public class pbXpWkr extends JApplet {
// INSTANCE VARIABLES
private JSObject htmlWindow;
public void init() {
// JAVASCRIPT COMMUNICATOR HTML REFERENCE
htmlWindow = JSObject.getWindow(this);
}
// CALLING JAVA METHOD FROM JAVASCRIPT AND PASSING A VALUE
public void htmlTerminating(String stgMessage) {
JOptionPane.showMessageDialog(new JFrame(),
"Applet Ending - " + stgMessage,
"APPLET NOTICE",
JOptionPane.WARNING_MESSAGE);
}
public void start() { }
public void stop() { }
public void destroy() { }
}
----------------------
JAVA CODE END
---------------------
Reproducible: Always
Steps to Reproduce:
1.Click on the displayed page button
2.
3.
Actual Results:
There is no response.
Expected Results:
Expect to have a Java alert window appear
Comment 1•16 years ago
|
||
- if (_app == 'Netscape') { document.all.pbXpWkr.htmlTerminating("WOW"); }
+ if (_app == 'Netscape') { appletNameIs.htmlTerminating("WOW"); }
height="1"
+ type="application/x-java-applet;version=1.4"
+ code="pbXpWkrPackage.pbXpWkr.class"
mayscript="true">
Please debug your code before blaming others.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•16 years ago
|
||
I've made your suggested changes and it still does not run. Were you able to get it running with the changes you suggested? I haven't!!!
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
| Reporter | ||
Comment 3•16 years ago
|
||
Mr.Kimura was not entirely correct but I've got it working now. My apologies.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago → 16 years ago
Resolution: --- → FIXED
Comment 4•16 years ago
|
||
This works perfectly for me.
Updated•16 years ago
|
Resolution: FIXED → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•