What’s the width and height of the visible part of my browser?!

If you ever wondered what your browser height and width is, don’t waste your time anymore but check it out with JavaScript. Actually there’s a difference, normally, between document height and the browser height for instance. The document can be higher than the browser, and that occurs when there’s a vertical scroll on the page.

In fact it’s quite easy to get the browser height and width (what we see as the white part of a blank page).

Simply check that out by dumping:

window.innerWidth & window.innerHeight

Related posts:

  1. jQuery CSS functions. Part 2 – width() and height()
  2. javascript: detect browser speed and load the “slow connection” site version
  3. Scroll the page with JavaScript
This entry was posted in javascript, micro tutorial and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">