Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Chrome browser width (IGNORING Scrollbars)

I need the width of the Chrome browser window and my current code is:

$("input#myHiddenValue").val($(window).width());

I call this from a page which has a scrollbar, but I need it to be the full width of the Chrome browser without a scroll bar.

Can anyone help?

like image 624
pfeds Avatar asked Apr 15 '26 21:04

pfeds


1 Answers

Check out:

window.screen.availWidth

I found this in a doc: Returns the amount of horizontal space in pixels available to the window.

And it is larger than my ? this.width`.

like image 63
beardhatcode Avatar answered Apr 17 '26 12:04

beardhatcode



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!