Link to home
Start Free TrialLog in
Avatar of cdpMat
cdpMat

asked on

Expand small window

I have a script which expands a window to the full width and height of the users screen:

function expand() {
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
}

But if the users window is maximized it actually reduces it slightly. Is there a way to invoke the above script only if the window is not maximized?

Thanks,
Matt
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nushi
Nushi

Batalf

another thing:
the scrollbars on IE are 20px

Nushi.
Of course you're right. Then there has to be added even 20 pixels to this test

if((window.innerWidth + 30) > screen.availWidth) width = window.innerWidth;

Try out different values until you've reached the right one.

The height is harder because there's a different between Netscape and IE, and also differences between IE-users. Somebody uses fullscreen, others have in addition to standard toolbars special toolbars +++.
Avatar of Richie_Simonetti
Scrollbars depends on user settings to that matter, not always is 20px.