JavaScript Problem in Firefox (Mac and Windows)

Upload core product.
Post Reply
drawo
Posts: 1
Joined: Tue May 22, 2012 2:00 pm

JavaScript Problem in Firefox (Mac and Windows)

Post by drawo »

Hi,

Firefox 12.0 shows a strange behavior in my application.
A short description of my implementation:

1. page is loaded
2. the applet is created using JavaScript
3. as soon as it is loaded, the applet is hidden (the surrounding <div> is set to display: none)
4. by clicking on a button, the applet is made visible again
5. the user starts uploading etc. (normal functionality)
6. a JavaScript checks getFilenames() (JS API) and dynamically change some page elements if the upload is finished

This all took quite some effort to figure out, but now it works as expected in Safari (Mac), IE, Opera; in Firefox however (Mac & Windows), as soon as the applet is made visible (step 4 above), I receive the following messages on the JS console:

Error: u.getFilenames is not a function
and
Error: u.setProperty is not a function

u is the Applet element:
var u = document.getElementById("uploader"); // uploader is the applet's JS id

The object is created using JavaScript:
var attributes = {code:"jfileupload.upload.client.MApplet.class",
archive:"/js/upload/jfileupload.jar,/js/upload/ftpimpl.jar,/js/upload/cnet.jar,/js/upload/clogging.jar,/js/upload/quaqua-filechooser.jar,/js/upload/qqlnf.jar",
width:"100%", height:250, id:"uploader", name:"uploader"} ;
var parameters = {fontSize:14, name:"fileupload", scriptable:true, url:"###", regfile:"###", […] };
deployJava.runApplet(attributes, parameters, minVersion);


Some debugging shows that as long as the applet is hidden, getFilenames and setProperty are defined and are functions { [Native code] } as expected,
but as soon as the applet is made visible (<div style="display: block;">) they are "undefined".
The applet itself is still reported as [Object HTMLAppletElement] and is not null.

I am out of ideas now. Does anybody have an idea how to work around this?
As mentioned before, it works ok on the other browsers.

We paid for the Pro version, by the way, if this makes a difference for support.

Regards,
d.

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: JavaScript Problem in Firefox (Mac and Windows)

Post by support »

Fixed by:
I did not set the containing <div> to "display: none" but I used "height: 0" (it has position: absolute). This is apparently different to using "display: none". In the latter case, the errors (u.getFilenames is not a function etc.) do now appear _before_ the applet is made visible, but after setting "display: block" the applet is there and the functions are available – no more errors from then on (and I can deal with the errors in the hidden state, they are no problem).

Post Reply