You are here: irt.org | FAQ | JavaScript | Java | Q1147 [ previous next ]
Try this (v4 browsers only):
<html>
<body>
<script language="JavaScript"><!--
w = 640;
h = 480;
NS4Plus = (document.layers) ? 1 : 0;
IE4Plus = (document.all) ? 1 : 0;
if (NS4Plus) {
w = window.innerWidth;
h = window.innerHeight;
}
if (IE4Plus) {
/* The script must be inside the body tags - there is no body in the head of the document */
w = document.body.clientWidth;
h = document.body.clientHeight;
}
// alert(w+'x'+h);
/* You might want to take 5% off the height and width to cater for scroll bars */
Text = '<applet width='+w+' height='+h;
Text += ' name="SomeApplet" code="somejava.class">';
Text += '\n<param...............>';
Text += '\n<\/applet>';
document.write(Text);
//--></script>
</body>
</html>