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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
innerWidthis supported by IE9 not IE8, you can do this insteaad: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.