PDA

View Full Version : Get size of browser window


pixelwit
03-01-2002, 02:25 PM
Is there a way to get the size of the viewable area of the browser window? I would like to be able to track how much of the browser's window is viewable even after the window has been resized.

Is it possible?

-PiXELWiT
http://www.pixelwit.com

tg
03-01-2002, 04:49 PM
javascript:
window.innerHeight: pixel height of document within browser's frame.
window.innerWidth: pixel width of document within browser's frame.
window.outerHeight: pixel height of browser (including toolbars,chrome, titlebar etc.).
window.outerWidth: pixel width of browser (including browser frame, chrome etc.).

pixelwit
03-01-2002, 05:01 PM
Thanks TG, but since I have like zero knowledge of javascript, I'm going to need to pester you for some more info. How would I go about getting those properties into my SWF as variables when the browser is resized? Know of any references that will help me out?

Thanks again,

-PiXELWiT
http://www.pixelwit.com

tg
03-01-2002, 05:54 PM
well, hmmm i'm kinda stumped here.

heres how i would do it (and expect it to work too).


myWidth=getURL("javascript:window.innerWidth;");
myHeight=getURL("javascript:window.innerHeight;");
trace(myWidth+","+myHeight);


but when i ran a test, it didn't work.
i'll have to dig around in some of my resources to see if these objects are supported by ie (my browser of choice).

pixelwit
03-01-2002, 10:21 PM
Thanks TG, I appreciate your help. One more question, will I be able to detect the "resizeEvent" or wil I need to keep checking if the size of the window has changed?

-PiXELWiT
http://www.pixelwit.com

tg
03-02-2002, 01:26 AM
look at this one:
http://www.actionscripts.org/forums/showthread.php3?s=&threadid=8856&highlight=resize
maybe, maybe not.