Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
167
rated 0 times [  171] [ 4]  / answers: 1 / hits: 43487  / 13 Years ago, thu, february 23, 2012, 12:00:00

In all recent browser:



 window.innerWidth // 1920


In Internet explorer 8



 window.innerWidth // undefined


What is the best way to get this value in IE8?


More From » javascript

 Answers
78

The innerWidth is supported by IE9 not IE8, you can do this insteaad:



var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;


The above line will get you the width from IE as well as other standard-compliant browsers.






If you use jQuery, $(window).innerWidth() will give you desired result in all browsers too.


[#87273] Wednesday, February 22, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaceyr

Total Points: 510
Total Questions: 97
Total Answers: 116

Location: Solomon Islands
Member since Fri, Oct 8, 2021
3 Years ago
kaceyr questions
;