📜  html 获取用户屏幕分辨率 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:23.306000             🧑  作者: Mango

代码示例1
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}`);
}

// test
getResolution();
// Your screen resolution is: 3840 x 2160