最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Firefox and Chrome window widthheight showing differently - Stack Overflow

matteradmin7PV0评论

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
Post a comment

comment list (0)

  1. No comments so far