Firefox 上的奇怪 Lightbox / iframe / Java 小程序问题
我正在使用在 Firefox 灯箱内显示的 iframe 中运行的 java 小程序的组合来解决奇怪的问题。
当页面直接显示时,对小程序
document.appletname.send
功能的 javascript 调用完美,但是当从 lightbox 内部调用时(实际上 lightwindow ) 然后返回错误
Error: document.appletname.send is not a function
这只发生在 Windows 中的 Firefox 上。 IE、Safari 和 Chrome 都可以,Ubuntu 上的 Firefox 也可以。
有关信息,该小程序是 Wirefusion 3D 演示,您可以通过单击 Highland Laddie 3D 位于页面底部,或直接在包含灯箱的页面。
我尝试添加 javascript 诊断代码来检查小程序是否存在并具有正确的名称(确实如此)。我看到的唯一奇怪的事情是,使用 Firefox,小程序似乎开始加载两次。
补充:回答一个问题。灯箱中调用的页面非常简单,就这样,
<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>
只有 iframe 本身和一个关闭按钮。造成麻烦的 javascript 代码是 iframe 调用的页面。我在 iframe 中添加了 javascript 代码进行检查,它仅报告页面中的一个小程序 - 因此该小程序不能在其嵌入的页面内加载两次。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Lightbox 和克隆有时会引起麻烦,因为它们将 DOM 元素从上下文中移动(或者在最坏的情况下,将其复制)到 Lightbox 容器中。这可能是 IFRAME 被加载两次的原因。
如果该小程序不在 IFRAME 中,我猜测 Lightbox 会复制该小程序,并且对
document.appletname
的所有后续调用都必须失败。但是,如果 Java Applet 嵌入到 IFRAME 中,我看不出这是如何发生的。您是否可能从 IFrame 外部引用 Applet?你能显示参考代码吗?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?