In my case, window.innerWidth involved in creating a custom modal popup. Simply put, the user presses a button, a pop-up window opens in the center of the browser, and a transparent black bkgd appears behind the pop-up window. My problem was finding the width and height of the browser to create transparent bkgd.
window.innerWidth works great to find the width, but remember that window.innerWidth and window.innerHeight does not compensate for the scrollbars, so if your content goes beyond the visible area of ββthe content. I had to subtract 17px from the value.
transBkgd.style.width = (window.innerWidth - 17) + "px";
Since the content of the site always goes beyond the visible height, I could not use window.innerHeight . If the user scrolls down, transparent bkgd would end at that moment, and it looked just nasty. To maintain transparent bkgd all the way to the bottom of the content, I used document.body.clientHeight .
transBkgd.style.height = document.body.clientHeight + "px";
I tested the popup in IE, FF, Chrome, and it looks good in all directions. I know that this is not too closely related to the original question, but I believe that this can help if someone else runs into the same problem when creating a custom modal popup.
Dzeimsas Zvirblis Jul 12 2018-12-12T00: 00Z
source share