Firefox 22 has a broken javascript screen.height detection
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.
所有回覆 (5)
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).
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)
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....
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.
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....