html get user screen resolution

Solutions on MaxInterview for html get user screen resolution by the best coders in the world

showing results for - "html get user screen resolution"
Maria
20 Apr 2018
1function getResolution() {
2  const realWidth = window.screen.width * window.devicePixelRatio;
3  const realHeight = window.screen.height * window.devicePixelRatio;
4  console.log(`Your screen resolution is: ${realWidth} x ${realHeight}`);
5}
6
7// test
8getResolution();
9// Your screen resolution is: 3840 x 2160
10
11
similar questions
media screen meta tag