Mozilla VPN is currently experiencing an outage. Our team is actively working to resolve the issue. Please check the status page for real-time updates. Thank you for your patience.

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

Wrong detection of screen.width and screen.height

  • 7 replies
  • 16 have this problem
  • 1 view
  • Last reply by JulioG

more options

Latest version (26.0 Windows)

After seeing unexplainable behaviour I built a page with an alert

alert (screen.width+  -  +screen.height)

The first time I load the page the answer is correct: 1920 - 1080 If I leave the page and I load it again the answer is: 1536 - 864

- - -

The odd beahaviour consists of altering sizes and positions for sizes and images. Other browsers (Chrome, Opera, Safari and even the old IE ver 8) behave as expected. I unistalled Firefox and installed it again without any luck.

Thanks.

Latest version (26.0 Windows) After seeing unexplainable behaviour I built a page with an alert alert (screen.width+ - +screen.height) The first time I load the page the answer is correct: 1920 - 1080 If I leave the page and I load it again the answer is: 1536 - 864 - - - The odd beahaviour consists of altering sizes and positions for sizes and images. Other browsers (Chrome, Opera, Safari and even the old IE ver 8) behave as expected. I unistalled Firefox and installed it again without any luck. Thanks.

All Replies (7)

more options

This happens when you zoom the page somehow. Zooming a web page has effect on the screen dimensions as reported via JavaScript.

Reset the page zoom on pages that cause problems.

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

Sorry, nothing to do with zoom. This was the first thing I checked!

more options

Did you make changes to the DPI settings in Windows or in Firefox?

  • layout.css.devPixelsPerPx
  • layout.css.dpi
more options

Did you make changes to the DPI settings in Windows or in Firefox?

No. Don't even know what are you talking about.

- - -

To perhaps increase the confusion, I'll mention that we were testing a new web page made by an unexperienced webmaster and different persons in different locations and with obviously different computers were seeing strange behaviours with Firefox. Perfect with other browsers.

Besides sacking the webmaster for other reasons, I then decided to pursue the research. At least I wanted to determine under what conditions the odd behaviour happened. By intuition I made the test page with the alert and to my surprise I obtained different widths and heights (see my initial message). At this moment I realised that I was completely lost.

Thanks for your interest.

Modified by JulioG

more options

A good place to ask advice about web development is at the mozillaZine "Web Development/Standards Evangelism" forum.

The helpers at that forum are more knowledgeable about web development issues.
You need to register at the mozillaZine forum site in order to post at that forum.

Note that your first post needs to be approved as an anti-spam measure.

Modified by cor-el

more options

Thanks for the hint but the problem has nothing to do with web development. It has to do with Firefox which, in very many webs, performs differently than the whole group of "other browsers".

In former days I had a preference of use in favour of FF. With later versions and because of its oddities I stopped using it in favour of other browsers. It is not until recently that I have discovered the wrong answers to resolution queries (screen.width and screen.height).

more options

To further illustrate the situation. I attach 2 uncropped screen captures. These were originally 1920x1080 and have been reduced to the same extend to avoid space and size nuisances here.

The page contains a fuchsia rectangle of 1024 x 768 pixels. My monitor is 1920 x 1080 px.

Chrome and other browsers display the size correctly. Firefox displays the size as magnified (because he "thinks" my screen is 1536 x 864 ; this is what he answers when asked by the alert [screen.width/height])

All browsers have been carefully checked to be in "standard size" (no zoom).

- - -

A simmilar situation arises with font sizes (and weight in Verdana).