<!DOCTYPE html>
<html lang="en-US">
<body>
<p>Return the window's width and height:</p>
<button onclick="myFunction()">Click Me</button>
<p id="point"></p>
<script>
var win = document.defaultView;
var x = document.getElementById("point");
function myFunction(){
var w = win.innerWidth;
var h = win.innerHeight;
x.innerHTML = "innerWidth: " + w + "<br>innerHeight: " + h;
}
</script> </body>
</html>