Return to Snippet

Revision: 48637
at July 7, 2011 00:30 by devnull69


Updated Code
var viewportWidth;
var viewportHeight;
if(window.innerWidth) {
   // normal browsers (incl. scrollbars)
   viewportWidth = window.innerWidth;
   viewportHeight = window.innerHeight;
} else {
   // IE (and all other browsers ... minus the scrollbar(s))
   viewportWidth = document.documentElement.clientWidth;
   viewportHeight = document.documentElement.clientHeight;
}

Revision: 48636
at July 6, 2011 23:50 by devnull69


Initial Code
var viewportWidth;
var viewportHeight;
if(window.innerWidth) {
   // normal browsers
   viewportWidth = window.innerWidth;
   viewportHeight = window.innerHeight;
} else {
   // IE
   viewportWidth = document.documentElement.clientWidth;
   viewportHeight = document.documentElement.clientHeight;
}

Initial URL

                                

Initial Description

                                

Initial Title
Browser dependent viewport size

Initial Tags

                                

Initial Language
JavaScript