No other methods are applicable. Only this documentElement can correctly obtain the size of the current visible area. var w = parseInt(document.documentElement.clientWidth); var h = parseInt(document.documentElement.clientHeight);