How to find out height and width of window WITHOUT JQUERY? [duplicate]

5

I've been wondering this for some time. I tried somehow to figure out the size of window (the browser window), but I could not do that.

With jQuery I already know what it's simply doing:

 $(window).height()

But, in case I do not have it with jQuery, I do not know how to do it.

Does anyone know how to get the height of the window (as with window in jQuery), but without jQuery?

    
asked by anonymous 13.11.2015 / 19:52

2 answers

7

You can use window.inner... :

var w = window.innerWidth;
var h = window.innerHeight;
document.write(w + ' width ');
document.write(h + ' height');
    
13.11.2015 / 20:01
3

Get size with toolbars / scrollbars

Reference: w3schools

var w = window.outerWidth;
var h = window.outerHeight;
 
document.write(w + ' width /' + h + ' height');
    
13.11.2015 / 20:06