Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strike><a href="http://www.javascripter.net/faq/browserw.htm" rel="nofollow noreferrer">http://www.javascripter.net/faq/browserw.htm</a></p> <p>Note that the code that uses <code>document.body.offsetWidth</code> and <code>document.body.offsetHeight</code> must be executed after the browser has parsed the tag.</strike></p> <p>Update: Try this</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;!-- var viewportwidth; var viewportheight; // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) else if (typeof document.documentElement != 'undefined' &amp;&amp; typeof document.documentElement.clientWidth != 'undefined' &amp;&amp; document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } // older versions of IE else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } document.write('&lt;p&gt;Your viewport width is '+viewportwidth+'x'+viewportheight+'&lt;/p&gt;'); //--&gt; &lt;/script&gt; </code></pre> <p>Found <a href="http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/" rel="nofollow noreferrer">here</a></p>
 

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