admin管理员组

文章数量:1026103

My laptop display resolution is 1280 x 800. When I query $(window).width() I get 1420 on Firefox while I get 1280 on Chrome. Why is Firefox showing me a window width greater than my screen resolution?

My laptop display resolution is 1280 x 800. When I query $(window).width() I get 1420 on Firefox while I get 1280 on Chrome. Why is Firefox showing me a window width greater than my screen resolution?

Share Improve this question asked Jan 26, 2013 at 3:07 irvyirvy 231 silver badge5 bronze badges 6
  • Why are you using a library only to show the window dimensions? use: screen.height and screen.width for total dimensions, & screen.availHeight and screen.availWidth for available dimensions. don't forget to check if the screen is zoomed. – Erick Ribeiro Commented Jan 26, 2013 at 3:10
  • 1 You are querying the width of your browser window, not your physical screen size. The window width will change if you resize your browser, have more toolbars installed, etc. @Erik Riberio's suggestion below is what you are looking for. – Chris Barr Commented Jan 26, 2013 at 3:16
  • @ChrisBarr - I think he is asking why the returned window width is greater than the screen width. And I don't think you can resize the window bigger than the screen. – Derek 朕會功夫 Commented Jan 26, 2013 at 3:36
  • Ah, it totally missed that point! Sorry. – Chris Barr Commented Jan 26, 2013 at 3:41
  • @Derek Yes, you can. just use the firefox Responsive Design View [Ctrl + Shift + M] and set the screen the size you want. – Erick Ribeiro Commented Jan 26, 2013 at 4:00
 |  Show 1 more ment

1 Answer 1

Reset to default 6

Because your Firefox window is probably zoomed out.

Reset the zoom using one of the following:

  • CTRL+0 (or CTRL+SHIFT+0 in some keyboard layouts)
  • View (or ALT+V) > Zoom > Reset

My laptop display resolution is 1280 x 800. When I query $(window).width() I get 1420 on Firefox while I get 1280 on Chrome. Why is Firefox showing me a window width greater than my screen resolution?

My laptop display resolution is 1280 x 800. When I query $(window).width() I get 1420 on Firefox while I get 1280 on Chrome. Why is Firefox showing me a window width greater than my screen resolution?

Share Improve this question asked Jan 26, 2013 at 3:07 irvyirvy 231 silver badge5 bronze badges 6
  • Why are you using a library only to show the window dimensions? use: screen.height and screen.width for total dimensions, & screen.availHeight and screen.availWidth for available dimensions. don't forget to check if the screen is zoomed. – Erick Ribeiro Commented Jan 26, 2013 at 3:10
  • 1 You are querying the width of your browser window, not your physical screen size. The window width will change if you resize your browser, have more toolbars installed, etc. @Erik Riberio's suggestion below is what you are looking for. – Chris Barr Commented Jan 26, 2013 at 3:16
  • @ChrisBarr - I think he is asking why the returned window width is greater than the screen width. And I don't think you can resize the window bigger than the screen. – Derek 朕會功夫 Commented Jan 26, 2013 at 3:36
  • Ah, it totally missed that point! Sorry. – Chris Barr Commented Jan 26, 2013 at 3:41
  • @Derek Yes, you can. just use the firefox Responsive Design View [Ctrl + Shift + M] and set the screen the size you want. – Erick Ribeiro Commented Jan 26, 2013 at 4:00
 |  Show 1 more ment

1 Answer 1

Reset to default 6

Because your Firefox window is probably zoomed out.

Reset the zoom using one of the following:

  • CTRL+0 (or CTRL+SHIFT+0 in some keyboard layouts)
  • View (or ALT+V) > Zoom > Reset

本文标签: javascriptFirefox and Chrome window widthheight showing differentlyStack Overflow