Get Screen Resolution of user's device | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Get Screen Resolution of user's device

how to get actual screen resolution of mobile device. please notice that it should not return viewport of the browser but actual screen resolution of mobile device.

15th Feb 2017, 3:41 PM
Zain Khalid
Zain Khalid - avatar
2 Answers
+ 3
Are you really sure to need the real screen resolution of the mobile device? There's good reasons to handle virtual resolution on mobile device, and you can get the screen density ( number of real pixel per css pixel ) for responsive image serve... To get few more information of how css pixels works quickly: https://coderwall.com/p/ygcyha/how-to-get-real-mobile-css-resolutions-for-responsive-design To dive in almost complete explanation on it: http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html And at least, but not last, a discussion on stackoverflow about your question ( second link was found here, even if I already known Quirksmode site ): http://stackoverflow.com/questions/20695196/screen-width-vs-device-real-resolution
15th Feb 2017, 5:01 PM
visph
visph - avatar
- 1
http://fellowtuts.com/jquery/how-to-detect-the-screen-resolution-with-javascript/
15th Feb 2017, 4:46 PM
John Afolayan