0

I know this question has been asked lots of times (the main proposed solution is: window.innerWidth - document.documentElement.clientWidth). On Chrome version 89, for me, both these values return the same value. All other answers I've tried (including this one: How can I get the browser's scrollbar sizes?) don't work.

Btw, I'm trying to determine the width of the 'general' page scrollbar. It would be nice to have this because it does affect the layout.

Are there any cross-browser solutions to this?


Example of scroll-bar:

example

tonitone120
  • 1,920
  • 3
  • 8
  • 25
  • 1
    I suspect those values are equal because there is no scrollbar where you tested. – Theraot Apr 03 '21 at 13:04
  • Do you know what I mean when I say the general scrollbar? I've attached a screenshot to show you an example – tonitone120 Apr 03 '21 at 19:07
  • https://i.stack.imgur.com/ySWrJ.png – Theraot Apr 03 '21 at 19:10
  • @Theraot As my question states, both those values return the same value for me (e.g. `window.innerWidth` - `document.documentElement.clientWidth` is `0`(px) – tonitone120 Apr 04 '21 at 12:03
  • @Theraot in your screenshot was that a Chrome browser? The scrollbar looks really old fashioned. – tonitone120 Apr 07 '21 at 21:20
  • Yes, that is Google Chrome, and it is up to date. That screenshot has a custom theme (by Yulia Brodskaya, you can search it), I tried without it, and got the same result. It is Windows 10, don't know if that makes any difference. – Theraot Apr 07 '21 at 23:31

0 Answers0