This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Firefox 22 has a broken javascript screen.height detection

  • 5 cavab
  • 15 have this problem
  • 1 view
  • Last reply by DA Ward

more options

my website detects the browsers' screen size by accessing javascript screen.height and screen.width at the first page load. Upon changing to Firefox 22 from 21, this feature is broken. It now detects a 1280 by 800 laptop as 1024 by 640 which ruins the site presentation. Chrome and IE both detect the screen height and width correctly, as did Firefox 21.

my website detects the browsers' screen size by accessing javascript screen.height and screen.width at the first page load. Upon changing to Firefox 22 from 21, this feature is broken. It now detects a 1280 by 800 laptop as 1024 by 640 which ruins the site presentation. Chrome and IE both detect the screen height and width correctly, as did Firefox 21.

All Replies (5)

more options

hello, firefox 22 is now respecting the pixel density you've set on a system level in the windows control panel > appearance > display. more information about that is available at http://windows.microsoft.com/en-us/windows7/make-the-text-on-your-screen-larger-or-smaller

if you want to set the text size/pixel density in firefox different from that of your system's settings like it was handled in prior versions, enter about:config into the firefox address bar (confirm the info message in case it shows up) & search for the preference named layout.css.devPixelsPerPx. double-click it and change its value to 1.0 (or any other zoom factor that fits your purpose: 1.0 relates to 100%, 0.8 equals 80% and so on; -1.0 is the default value and will adhere to the system settings).

more options

Make sure that you aren't zooming those pages.

Reset the page zoom on pages that cause problems.

  • View > Zoom > Reset (Ctrl+0 (zero); Command+0 on Mac)
more options

Thanks. There was no Appearance icon on my Control Panel, but I actually found the settings under "Ease of Access Center > Make this Computer Easier to See > Change the Size of Text and Icons. That brought up the "DPI Scaling Control Panel", which allowed me to reset the screen to 96 dpi from 120 dpi.

All 3 browsers now agree that the screen size is 1280 by 800. But still, in the case of users who have a desktop or laptop set to 120 dpi: advertant or not, Firefox 22 is the only browser that is going to misidentify their screen size to the Javascript engine. That's sad, because much of the web depends on javascript's evaluation of the user's screen size....

more options

hello, but if the dpi preference is set to 120 on a system level, then firefox will now also display web-content with this scaling. as a web developer you probably want to know & adapt to the size that is observable by the user and not the technical specifications of the screen he's using.

more options

No:

As a web developer, you are mainly concerned with the page fitting the user's screen. Whether that page contains big, fuzzy letters, or small sharp ones is secondary, and was actually the user's choice. If the 3 major browsers could agree on notifying the javascript engine about the user's actual resolution, it would be fine.

Looks like I will have to go back to individually identifying browsers, and computing the web page dimensions differently for each....