Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Get client screen size in a browser by Javascript

Digital Innovation Partner

Get client screen size in a browser by Javascript

using this simple code you can have the size of your client area in pix

function getScreenSize() {
var w = window,
    d = document,
    e = d.documentElement,
    g = d.getElementsByTagName('body')[0],
    x = w.innerWidth || e.clientWidth || g.clientWidth,
    y = w.innerHeight|| e.clientHeight|| g.clientHeight;

    return x + 'px ' + y + 'px';

}


 
window.addEventListener('resize',);