IE with OBJECT-tag for applet issue

A

andrewfsears

Okay, I've got one that i'm not so sure about, and i don't know if this
belongs here...

I have an applet that is an extension of the JApplet class.
To avoid cross-browser issues with loading it, I use a javascript to
create the applet tag in the web page: <embed> for Netscape/Firefox,
<object> for IE, <applet> for "else" (for good measure, these tags also
have the safeguard to ensure that JRE 1.4+ is installed).

These will load the applet correctly, except when the JRE is installed.
After installation, in IE only, when i try to retrieve the applet
object in a Javascript code (for example: appletObject.isActive), it
does not get the applet. Instead, when i "alert" the object by calling
document.getElementById("theApplet");
i get the following message:

com.company.MyApplet[panel2,0,0,400x500,layout=java.awt.BorderLayout,rootPane=javax.swing.JRootPane[,0,0,400x500,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=385,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

The <object>-tag that is generated looks correct when I "alert" that.

Anyone have any idea why?

Also, after installing the JRE, rebooting, clearing caches, internet
pages, etc. does not make a difference.
 
A

andrewfsears

Andrew T.,
Thank you for the response, but it turned out it was something
completely different than what I initially thought.

If anyone is looking for a solution to this, here's the short of it:
DEBUG your JavaScript code.

And with Internet Explorer, this can be really tricky, especially
trying to figure out what the issue is with their messages being less
than helpful.

Here's where my issue resolved to...

My applet uses the Netscape LiveConnect to communicate between the
JavaScript and the Java. I had a
setupApplet(String name, int width, int height) {...}
method in my Applet code, and then in my JavaScript, i had the
following lines:
var theApplet = document.getElementById("theAppletName");
if (theApplet.isActive) theApplet.setupApplet("name",
theApplet.width, theApplet.height);
or something like that.

Now, before the JRE update, it would work correctly. After the JRE
update, it worked fine in Firefox, but in IE, it did not. Here's the
reason(s): it turns out that in IE, the "theApplet.width" was returning
a string-version of the number, and then trying to pass in a string
where an integer should be. IE didn't like it, and thus kicked a (not
so helpful) error. Also, because of the Applet class being returned,
"theApplet.isActive" is not going to work as well, because it's not a
proper method call.

So, the resulting line should be:
if (theApplet.isActive()) theApplet.setupApplet("name",
parseInt(theApplet.width), parseInt(theApplet.height));


Here's my new question: why would the call work before any JRE upgrade?

Thanks, Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top