Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #user #screen #resolution
ADD COMMENT
Topic
Name
8+9 =