Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To determine the actual size(using javascript) of the browser window, use the following properties:</p> <p>in Internet Explorer (backward-compatibility mode): </p> <pre><code>document.body.offsetWidth, document.body.offsetHeight </code></pre> <p>in Internet Explorer (standards mode, document.compatMode=='CSS1Compat'): </p> <pre><code>document.documentElement.offsetWidth, document.documentElement.offsetHeight </code></pre> <p>in most other browsers: </p> <pre><code>window.innerWidth, window.innerHeight The following code sets the variables winW and winH to the actual width and height of the browser window, and outputs the width and height values. If the user has a very old browser, then winW and winH are set to 630 and 460, respectively. var winW = 630, winH = 460; if (document.body &amp;&amp; document.body.offsetWidth) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } if (document.compatMode=='CSS1Compat' &amp;&amp; document.documentElement &amp;&amp; document.documentElement.offsetWidth ) { winW = document.documentElement.offsetWidth; winH = document.documentElement.offsetHeight; } if (window.innerWidth &amp;&amp; window.innerHeight) { winW = window.innerWidth; winH = window.innerHeight; } document.writeln('Window width = '+winW); document.writeln('Window height = '+winH); </code></pre> <p>In your browser, this code produces the following output:</p> <pre><code>Window width = 1280 Window height = 675 </code></pre> <p>Notes: </p> <ol> <li>If the above code executes within a frame or iframe, it will give you the frame's width and height. </li> <li>The computed width and height do not include the title bar, menu bar, status bar, or toolbar(s) - but may include the horizontal and vertical scrollbar(s), if any. </li> <li>The code that uses document.body.offsetWidth and offsetHeight should be executed after the browser has parsed the tag. </li> <li>If the user resizes the browser window, you may need to recompute the width and height (use window.onresize to do so). </li> <li>Similarly, if the user zooms in (or zooms out) you may also need to recompute the width and height.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload