0

I tried this code How to get height of entire document with JavaScript?

and it gives 964 for edge on my computer, when I compare by copying and pasting the same area in paint, it gives 1085.

Why the discrepancies ?

user310291
  • 36,946
  • 82
  • 271
  • 487
  • Which question is more important? _I tried this code How to get height of entire document with JavaScript?_ try: `document.body.getBoundingClientRect()`. This: _Why the discrepancies?_ probably because your screenshot software is not actually capturing the viewport. – Randy Casburn May 19 '19 at 18:25
  • If you mean pixel, this is because pixel doesn't really mean pixels anymore. This is due to high density screens. I'm not sure, but I've a feeling a pixel is representational of what a pixel would equal if it was used say on a 1024 / 768 sized screen on say a 15 inch monitor. I'm not sure if that's the exact metrics it uses, but it will be something like that. It's one of the reasons using pixels is discouraged, and more meaningful metrics like `rem` `em` etc are better. – Keith May 19 '19 at 18:27
  • Why?, it's most likely to help with backwards compatibility. Back when people still used pixels for page layout, 75DPI screens were more normal, and 800/600 or 1024/768, or even 1080p screen this was fine. But with screens now doing 300DPI + things would just look silly. – Keith May 19 '19 at 18:32

0 Answers0