Forum Moderators: open

Message Too Old, No Replies

Window Size, Again

         

rocknbil

9:46 pm on Dec 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This seems so simple. But the solution below still gives me "150" when I reduce the NN/FF browser window to one pixel deep.

Try compressing your window height to nothing in NN/FF. It will still show 150 (depending on what toolbars you're using.)

screen.availHeight would be great except that only measures the screen minus the taskbar. I need the VISIBLE space inside the browser window.

<HTML>
<HEAD><title>Foo # 67867545 </title>

<SCRIPT LANGUAGE="Javascript">
function init() {
var baseHeight;
if (window.innerHeight) { baseHeight= window.innerHeight + ' innerHeight'; }
else if (document.documentElement.offsetHeight) { baseHeight = document.documentElement.offsetHeight + ' offsetHeight'; }
else if (document.body) { baseHeight = document.body.clientHeight + ' clientHeight'; }
else { baseHeight = 1234; } // just so I know it's broken
alert(baseHeight);
}
</SCRIPT>
</HEAD>
<BODY onload="init();">
Test
</BODY>
</HTML>

tedster

10:38 pm on Dec 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



screen.availHeight would be great except that only measures
the screen minus the taskbar. I need the VISIBLE space inside
the browser window

How about window.availHeight?

rocknbil

10:53 pm on Dec 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you tedster I will give it a shot, although I did try it once and got an object error. :-) Was pretty frustrated at that point and may have (i.e. probably did) overlooked something obvious.

EDIT: No, doesn't appear to work either. window.availHeight is undefined, and window.screen.availHeight returns the screen depth minus the scrollbars. In the actual page it's shoving my objects down below the bottom scrollbar.

rocknbil

2:56 am on Dec 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could one of you possibly point me to a reference that would demonstrate how to accurately get the available inner real estate for a Mac MSIE browser? Thx.

Here's a **great** one. MSIE Mac returns 32 (pixels) for clientHeight no matter what the window size is. LOL . . .

tedster

6:33 pm on Dec 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Whew - this is a much more complex issue that we might hope. Things become even worse, because where you access various properties changes with the DTD, so you are not only looking at cross-browser issues but cross doctype issues.

Peter Paul Koch of quirksmode.org has done a hearty amount of research on the question, and posted a table of his results:

[quirksmode.org...]

rocknbil

4:38 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



THANK YOU! I thought I was just missing something terribly obvious. :D