0

I'm looking for a different approach to find browser resolution. As of now, we are using ${window.screen.width}x${window.screen.height} to find resolution.

In a few cases, it is giving a response as undefinedxundefined for browsers in ios/android. Is there any other approach to capture width and height

Tech Learn
  • 43
  • 9

1 Answers1

0

Yes, you absolutely can:

document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth,
document.documentElement.clientWidth

Please note that some modern devices have a density pixel rate of at least 2. So a browser screen size of 375px ends up being 750px (375px x 2) in your javascript.

S. Wannsee
  • 15
  • 6