Answers for "html get user screen resolution"

0

html get user screen resolution

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
Posted by: Guest on May-14-2021

Code answers related to "html get user screen resolution"

Browse Popular Code Answers by Language