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-
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>
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.
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.