Wrong detection of screen.width and screen.height
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.
所有回覆 (7)
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)
Sorry, nothing to do with zoom. This was the first thing I checked!
Did you make changes to the DPI settings in Windows or in Firefox?
- layout.css.devPixelsPerPx
- layout.css.dpi
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.
由 JulioG 於
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.
由 cor-el 於
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).
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).