Safari 及其他平台上的 Java Applet z-index

发布于 2024-07-15 03:17:31 字数 803 浏览 7 评论 0原文

网页中 Java Applet 的一个众所周知的问题是,浏览器会忽略 Applet 标记与页面中其他组件的 z 索引。 无论您如何在页面中定位元素和 z-index 元素,小程序都会将自己绘制在所有内容之上。

有一种解决方法,称为 iframe shim,如下所述: http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/

但是,此解决方法在 Windows 中的 Safari 3 或 4 中不起作用(假设 Mac 也是如此)。

有谁知道如何让它在 Safari 中工作?

有人知道如何迫使 Sun 解决根本问题,从而避免笨拙的垫片吗? 这是有关该问题的错误报告,https://bugs.java.com/bugdatabase /view_bug?bug_id=6646289,请注意,它已经开放一年了,但是其他错误报告可以追溯到很多年前。

这太令人沮丧了,难道 Sun 不明白正是这种情况使 Java 被边缘化,成为在浏览器中做很酷的事情的一种方式吗? 我爱你Java,但你并没有帮助你的情况......

A well known problem with Java Applets in webpages is that browsers ignore the z-index of the applet tag vs. other components in the page. No matter how you position and z-index elements in the page, applets will draw themselves on top of everything.

There is a workaround, known as the iframe shim, as described here: http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/.

However, this workaround does not work in Safari 3 or 4 in Windows (assuming the same for Mac).

Does anyone know a way to make it work in Safari?

Does anyone have ideas about how to pressure Sun to fix the underlying problem so we can avoid clumsy shims? Here is a bug report on the issue, https://bugs.java.com/bugdatabase/view_bug?bug_id=6646289, notice that it has been open for a year, however other bug reports go back many many years.

This is so frustrating, don't Sun understand that this is the very sort of thing that has marginalized Java as a way of doing cool stuff in the browser? I love you Java, but you are not helping your situation...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

メ斷腸人バ 2024-07-22 03:17:32

这个问题有一个棘手的解决方案。 没有必要将代码放在 iframe 中。 我们可以有一个虚拟的iframe,就像小程序上面的一层。 然后,可以轻松地将带有文本的绝对 div 放置在该 iframe 之上。

工作示例

<!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" />
<title>Applet z index issue</title>
<style>

.applet {width:400px; margin:0 auto; text-align:center; border:1px solid #000; left:40%; position:absolute }
.iframe {width:400px;  background:#fff; position:absolute; border:1px solid #f00; position:absolute; left:45%; top:20px; z-index:9; height:201px;}
.message { width:250px; border:1px solid #000; background:#fff; height:150px; color:#fff; text-align:center;  z-index:99; background:#555;  float:left; position:absolute; left:45%; top:20px}

 </style>
</head>

<body>
<div class="message">Message</div>
<div class="iframe"><iframe style="width:500px; height:205px; background:none; border:none"> </iframe></div>
<div class="applet">

<applet code="Bubbles.class" width="400" height="350">
Java applet that draws animated bubbles.
</applet>

</div>

</body>
</html>

There is a tricky solution for the problem. It's not necessary to have the code inside an iframe. We can have a dummy iframe just as a layer above the applet. And then an absolute div with the text can easily placed above that iframe.

working example

<!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" />
<title>Applet z index issue</title>
<style>

.applet {width:400px; margin:0 auto; text-align:center; border:1px solid #000; left:40%; position:absolute }
.iframe {width:400px;  background:#fff; position:absolute; border:1px solid #f00; position:absolute; left:45%; top:20px; z-index:9; height:201px;}
.message { width:250px; border:1px solid #000; background:#fff; height:150px; color:#fff; text-align:center;  z-index:99; background:#555;  float:left; position:absolute; left:45%; top:20px}

 </style>
</head>

<body>
<div class="message">Message</div>
<div class="iframe"><iframe style="width:500px; height:205px; background:none; border:none"> </iframe></div>
<div class="applet">

<applet code="Bubbles.class" width="400" height="350">
Java applet that draws animated bubbles.
</applet>

</div>

</body>
</html>
流星番茄 2024-07-22 03:17:32

实际上问题与 z-index 根本无关。 这是由 Netscape Plugin API (NPAPI) 的“窗口化”绘图模型引起的。

你对此无能为力(除了垫片)。 插件作者必须使用无窗口 API 重写它< /a>.

Actually problem is not related to z-index at all. It's caused by "windowed" drawing model of Netscape Plugin API (NPAPI).

You can't do anything about it (except the shim). Plugin author has to rewrite it using windowless API.

风吹雨成花 2024-07-22 03:17:32

其一,Mac 上的 Java 实际上是由 Apple 而不是 Sun 构建的。 至于小程序,当小程序上面出现东西时,我们会隐藏小程序。 但这可能不足以满足您的需求。

For one, Java on Mac is actually built by Apple and not Sun. As for the applets, we hide the applets when there is something appearing on top of it. That might not suffice for your needs though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文