Get width and height of viewport

From wiki.network-crawler.de
Jump to: navigation, search
<script>
var width = document.body.offsetWidth;
var bodyHeight = document.body.scrollHeight;
var height = (typeof window.innerHeight !== "undefined")? window.innerHeight :  (document.documentElement)? document.documentElement.clientHeight : document.body.clientHeight;
	height = (bodyHeight > height)? bodyHeight : height;
</script>