I tried to get browser window width with $(window).width();
. On IE 10, it does return the full browser width, include the scroll bar. However, on Firefox and Ch
window.innerWidth
will give the width of the HTML and the scrollbar. This value is the value used for device width breakpoints when using media queries in CSS. Essentially, window.innerWidth
is equal to the calculated CSS unit 100vw
. However, window.outerWidth
will give you the width of the entire window.
For example, if you had Chrome's Dev Tools open inside of the browser, window.outerWidth
would be the width of the webpage + scroll bar + Chrome's Dev Tools inspector. While window.innerWidth
would return the width of just the webpage + scroll bar.