Page width and height

suggest change

window.innerWidth and window.innerHeight are the layout viewport in CSS pixels, including the scrollbar. The other branches are old fallbacks, and they measure different boxes: documentElement.clientWidth excludes the scrollbar, and document.body.clientWidth is the body width.

function pageWidth() {
  return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight() {
  return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents