Determine the current window height/width?

D

Dave Hammond

You'd think this would be a basic part of the window object (and
perhaps it is and I'm just being dense), but I can't find any reference
in the IE window object documentation to a property which returns the
current window height/width. I can't check Mozilla, as the site is
currently unresponsive, but i don't recall there being any mention of
height/width properties in the Mozilla window object docs either.
Seems like if the object can tell me what its current top/left corner
is, then it should be able to tell me what its size is. Am I missing
something?

As for the application, I'd like to be able to resize a window, run a
script, then restore the window to its original size when the script
completes.

Thanks in advance, and if I'm being blind or dense, please be gentle
with the flames.

-Dave H.
 
D

Dave Hammond

Well, I was able to get on mozilla.org and found the innerHeight and
innerWidth properties. A quick test shows they don't work in IE, so
I'm still stuck for a solution and would still appreciate any
recommendations (other than 'switch to Firefox' which is unfortunately
not an option ;)
 
D

DU

Dave said:
You'd think this would be a basic part of the window object (and
perhaps it is and I'm just being dense), but I can't find any reference
in the IE window object documentation to a property which returns the
current window height/width.

The content area (window viewport) only or the whole window? Anyway,
why would you need to determine the window dimensions of your webpage
visitor?

I can't check Mozilla, as the site is
currently unresponsive, but i don't recall there being any mention of
height/width properties in the Mozilla window object docs either.
Seems like if the object can tell me what its current top/left corner
is, then it should be able to tell me what its size is. Am I missing
something?

As for the application, I'd like to be able to resize a window, run a
script,

What does your script need to do?

then restore the window to its original size when the script
completes.

Most browser users now disable, turn off script abilities to resize and
move windows in a majority of browsers. Why would you need to resize the
browser window back and forth like that to begin with?
Thanks in advance, and if I'm being blind or dense, please be gentle
with the flames.

-Dave H.

DU
 
F

Fred Oz

Dave said:
You'd think this would be a basic part of the window object (and
perhaps it is and I'm just being dense), but I can't find any reference
in the IE window object documentation to a property which returns the
current window height/width. I can't check Mozilla, as the site is
currently unresponsive, but i don't recall there being any mention of
height/width properties in the Mozilla window object docs either.
Seems like if the object can tell me what its current top/left corner
is, then it should be able to tell me what its size is. Am I missing
something?

As for the application, I'd like to be able to resize a window, run a
script, then restore the window to its original size when the script
completes.

Thanks in advance, and if I'm being blind or dense, please be gentle
with the flames.

Please be gentle with browser windows. If this is for an intranet
and there are valid reasons for re-sizing windows, fine. But playing
with a user's windows on the internet is considered rude and
offensive - but if you want to annoy your visitors, that's up to you.

Anyhow, whatever you need to know can probably be found here:

<URL:http://www.quirksmode.org/>

Follow the 'viewport' and "Browser compatibility" links.
 
D

Dave Hammond

Thanks, Fred. It is, in fact, for a private intranet-based application
which opens multiple windows for various components of the application
(menu, main program, messages, etc). My reason for wanting to know the
original window size is so that upon logout from the application,
rather than be rude and leave the user with a resized window, I can
restore their original window dimensions and attributes.

-Dave H.
 
D

Dave Hammond

Hi DU,

As for my reasons for wanting to resize and move windows, please see my
response to Fred Oz. As for your opinion that most browser users now
disable script abilities to resize, I would respectfully disagree. The
vast majority of browser users wouldn't begin to know how to do that.
Sure, those who live and breath the internet know what they're doing,
but those who just use it as a means to an end (information,
entertainment, productivity, etc) still use the IE which came installed
on their PCs, and still consider most of the Tools menu options
(including preferences) to be places better left unexplored. Perhaps
sad, but undeniably true.

-Dave H.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top