views:

397

answers:

2

I'm beating my head against strange issue using a combination of a java applet running in an iframe displayed inside a lightbox on Firefox.

When the page is displayed directly an javascript call to the applet

document.appletname.send

Functions perfectly, however when called from inside a lighbox (actually lightwindow) then the error is returned

Error: document.appletname.send is not a function

This only occurs on Firefox in Windows. IE, Safari and Chrome are fine, as is Firefox on Ubuntu

For information the applet is a Wirefusion 3D presentation and you can see the applet running via the lightbox box by clicking on Highland Laddie 3D at the bottom of the page, or directly in the page containing the lightbox.

I've tried adding javascript diagnostic code to check that the applet exists and has the correct name (it does). The only odd thing I can see is that with Firefox the applet appears to start loading twice.

ADDED: In response to a question. The page being called in the lightbox is very simple, just this

<div style="position:absolute; top:0px; left:0px">
<iframe id="mainframe" 
src="http://www.tartanweb.com/laddie/highlandladdie.php" width="730px" height="670px" scrolling="no">
  <p>Your browser does not support iframes.</p>
</iframe>
</div>
<div style="position:absolute; top:15px; left:600px; z-index:1; width:30px;" >
<a href="blank-width.html" class="lightwindow_action" rel="deactivate"><input type="button" value="Close"></a>
</div>

So just the iframe itself and a close button. The javascript code giving the trouble is the page called by the iframe. I added javascript code in the iframe to check and it reports just one applet in the page - so the applet can't be being loaded twice inside the page it's embedded in.

A: 

Lightbox and clones sometimes cause trouble because they move (or in the worst event, copy) DOM elements out of their context into the Lightbox container. That might account for the IFRAME being loaded twice.

If the applet were not in an IFRAME, I would guess that the Lightbox duplicates the applet, and all subsequent calls to document.appletname must fail. However, if the Java Applet is embedded in an IFRAME, I can't see how that could happen. Are you maybe referencing the Applet from outside the IFrame? Can you show the referencing code?

Pekka
Not referencing from outside - I've added the full code called by the lightwindow to the question.
Cruachan
Hm. Then I would speculate that this might be a loading issue. The error turns up well before the Applet is displayed. Can you try delaying any communication with the `highlandladdie` object until the document is completely loaded?
Pekka
Ah yes. If I amend the launcher javascript (3rd party from Wirefusion) to change it from writing the applet code out directly to cache to a string then assign that to a div innerHTML after load then it works fine in Firefox. Of course it breaks it in IE, but that can be handled by spinning some browser specific code. Weirdly the applet still appears to start twice in firefox, but it works.
Cruachan
A: 

any resolution for this issue? we are having the same

gokhan
Ah yes. If I amend the launcher javascript (3rd party from Wirefusion) to change it from writing the applet code out directly to cache to a string then assign that to a div innerHTML after load then it works fine in Firefox. Of course it breaks it in IE, but that can be handled by spinning some browser specific code. Weirdly the applet still appears to start twice in firefox, but it works. –
Cruachan