Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is what I have used in the past when I needed to use a non jQuery way of identifying the size of the end user's screen. It is far from perfect but I have found it hits the high spots and works on most browsers. It also won't get the exact size, but if you are just concerned about displaying everything on the screen this works for me.</p> <pre><code>// Function to get the height of the end user's window function getWindowHeight() { var winHeight = 0; // Check for common mobile browser if ((screen.width &lt; 300)||(screen.height &lt; 300)) { if (( window.outerHeight != undefined )||( window.outerHeight &gt; 100 )){ winHeight = window.outerHeight; } else{ winHeight = screen.Height; } } // If not, check to see what Browser is being used. else { if( typeof (window.innerWidth ) == 'number') { //Non-IE winHeight = window.innerHeight; } else if(document.documentElement &amp;&amp; (document.documentElement.clientWidth || document.documentElement.clientHeight )) { //IE 6+ in 'standards compliant mode' winHeight = document.documentElement.clientHeight; } else if(document.body &amp;&amp; (document.body.clientWidth || document.body.clientHeight )) { //IE 4 compatible winHeight = document.body.clientHeight; } else if(screen.height == 'number'){ //IE Mobile 6.0 winHeight = screen.height; } } return winHeight; } // Function to get the width of the end user's window function getWindowWidth() { var winWidth = 0; // Check for common mobile browser if (input == "yes"){ if (( window.outerWidth != undefined )||( window.outerWidth &gt; 100 )){ winWidth = window.outerWidth; } else{ winWidth = screen.width; } } // If not, check to see what Browser is being used. else { if( typeof (window.innerWidth ) == 'number') { //Non-IE winWidth = window.innerWidth; } else if(document.documentElement &amp;&amp; (document.documentElement.clientWidth || document.documentElement.clientHeight )) { //IE 6+ in 'standards compliant mode' winWidth = document.documentElement.clientWidth; } else if(document.body &amp;&amp; (document.body.clientWidth || document.body.clientHeight )) { //IE 4 compatible winWidth = document.body.clientWidth; } else if(screen.width == 'number'){ //IE Mobile 6.0 winWidth = screen.width; } } return winWidth; } </code></pre> <p>You'll need to add a lot more if you want it to encompass all of the options out there, but hopefully this will get you somewhere.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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