Apple MBP Retina Screen 屏幕分辨率 All In One
Apple MBP Retina Screen 屏幕分辨率 All In One
error ❌
js get Retina Screen real size bug ❌
js solution ✅
js 获取屏幕实际的分辨率
(function getResolution() {
const realWidth = window.screen.width * window.devicePixelRatio;
const realHeight = window.screen.height * window.devicePixelRatio;
console.log(`
Your screen resolution is: ${realWidth} x ${realHeight}
Your screen devicePixelRatio is: ${window.devicePixelRatio}
Your screen width is: ${window.screen.width}
Your screen height is: ${window.screen.height}
`);
})();
// Your screen resolution is: 3840 x 2160 (4K)
// Your screen resolution is: 3360 x 2100 ( 2.5K Retina Screen)
// Your screen resolution is: 1920 x 1080 ( 1080P / FHD)
Built-in Retina Display: 15.4-inch (2880 × 1800) ❌
DELL S2419HM Display: 23.5-inch (1920 × 1080) ✅
bug reason 🎉
Apple Retina Screen default scale to 1680px
x 1050px
苹果视网膜屏幕默认缩放到 1680px
x 1050px
✅
https://www.cnblogs.com/xgqfrms/p/14196834.html
https://www.cnblogs.com/xgqfrms/p/14205521.html
默认
1680 x 1050
放大
1920 x 1200 (1080P === 1920 x 1080)
缩小
1400 x 900
缩小
1280 x 800
缩小
1024 x 640
DPI
https://en.wikipedia.org/wiki/Dots_per_inch
屏幕分辨率
https://en.wikipedia.org/wiki/Display_resolution
https://en.wikipedia.org/wiki/Display_resolution#/media/File:Vector_Video_Standards8.svg
https://cn.screenresolution.org/
refs
Windows PC
1366 x 768
MacBook Pro
2880 x 1800
https://stackoverflow.com/questions/65462643/how-to-get-the-real-screen-size-by-using-js
How to use js to detect the resolution of the screen All In One
如何使用 js 检测屏幕的分辨率
https://www.cnblogs.com/xgqfrms/p/14155206.html
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14196834.html
未经授权禁止转载,违者必究!