M
Martin Rinehart
Repeat of previous post, but this time the function works in standards
mode as well as in quirks mode.
I've checked the following pages on Konqi and Opera, KDE, and MSIE6,
7,
and recent FF, Chrome, Opera and Safari, Windows. It replaces the
absurdly complex FAQ 9.3 ( http://www.jibbering.com/faq/#getWindowSize
).
function clientSize() {
var d = document;
if ( d.clientHeight ) { return [d.clientWidth, d.clientHeight]; }
return [
Math.max( d.body.clientWidth, d.documentElement.clientWidth ),
Math.max( d.body.clientHeight,
d.documentElement.clientHeight ) ]
}
There is a quirks mode tester, here:
http://www.martinrinehart.com/examples/doc-elem.html
And there is a standards mode tester, here:
http://www.martinrinehart.com/examples/doc-elem-strict.html
I strongly encourage anyone who has solved other ugly bits of browser
incompatibilities to post similar solutions here, so that those who
come after may google for answers and not spend hours or days solving
problems unrelated to whatever they are trying to code.
mode as well as in quirks mode.
I've checked the following pages on Konqi and Opera, KDE, and MSIE6,
7,
and recent FF, Chrome, Opera and Safari, Windows. It replaces the
absurdly complex FAQ 9.3 ( http://www.jibbering.com/faq/#getWindowSize
).
function clientSize() {
var d = document;
if ( d.clientHeight ) { return [d.clientWidth, d.clientHeight]; }
return [
Math.max( d.body.clientWidth, d.documentElement.clientWidth ),
Math.max( d.body.clientHeight,
d.documentElement.clientHeight ) ]
}
There is a quirks mode tester, here:
http://www.martinrinehart.com/examples/doc-elem.html
And there is a standards mode tester, here:
http://www.martinrinehart.com/examples/doc-elem-strict.html
I strongly encourage anyone who has solved other ugly bits of browser
incompatibilities to post similar solutions here, so that those who
come after may google for answers and not spend hours or days solving
problems unrelated to whatever they are trying to code.