471,338 Members | 900 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Determine the current window height/width?

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.

Jul 23 '05 #1
5 6347
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 ;)

Jul 23 '05 #2
DU
Dave Hammond wrote:
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
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.7 :)
Jul 23 '05 #3
Dave Hammond wrote:
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.


-Dave H.

--
Fred
Jul 23 '05 #4
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.

Jul 23 '05 #5
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.

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by stellabein | last post: by
3 posts views Thread by Kamyk | last post: by
14 posts views Thread by D. Alvarado | last post: by
5 posts views Thread by Den | last post: by
9 posts views Thread by Adam | last post: by
4 posts views Thread by Perl Beginner | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.