Navigation
Taschenrechner
droid
foto
internet
pc
test
untechnisch
 

Fenstergröße mit JavaScript bestimmen

http://www.javascripter.net/faq/browserw.htm



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//Window Size
var winW = 630, winH = 460;
if (document.body && document.body.offsetWidth) {
 winW = document.body.offsetWidth;
 winH = document.body.offsetHeight;
}
if (document.compatMode=='CSS1Compat' &&
    document.documentElement &&
    document.documentElement.offsetWidth ) {
 winW = document.documentElement.offsetWidth;
 winH = document.documentElement.offsetHeight;
}
if (window.innerWidth && window.innerHeight) {
 winW = window.innerWidth;
 winH = window.innerHeight;
}
 
document.writeln('Window width = '+winW);
document.writeln('Window height = '+winH);

Updated on Nov 13, 2012 by Franz Fiala (Version 5)