We help IT Professionals succeed at work.

Set applet's width to browser's width

integrosys
integrosys asked
on
Medium Priority
333 Views
Last Modified: 2010-03-31
The width of an applet is set via the "width" attribute of the applet tag, which is specified in pixels. I would like the width of the applet to be dynamic, such that it will take up the entire width of the browser's window. When the browser is resized, the applet will resize accordingly. Can this be achived? Thanks.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
You'd need to use JavaScript for that
CERTIFIED EXPERT
Top Expert 2016

Commented:
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
try width 100%

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
>> try width 100%

Isn't width specified in pixels?
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
can be either

Commented:
objects is correct (width and height can be %).

To have mozilla browsers honor this, you must reload the page onResize:

<html>
<head>
<script language="JavaScript">
function resizer() {
      if(navigator.appName == 'Netscape') {
            history.go(0);
      } // end if
}
</script>
</head>

<body onResize="resizer();">
Your page's visual content.
</body>
</html>

Author

Commented:
Thanks. The solution from objects works for me. Somehow, CEHJ's solution doesn't seem to work.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.