
On 6 inch phone after setting display to small, most sites are now loading up in desktop mode (though it should go for the mobile site) How can this be fixed?
Just for reference, the issue only affects Mozilla, on Chrome for example all works nice and fine. (sites load up with their mobile initially.)
This is far from a tablet screen, it a 18:9 phone 6-inch screen, with display set to small
Solution choisie
They have forced Firefox for Android into the tablet UI. This makes Firefox for Android use the tablet user agent. The tablet user agent is different from the mobile version. Most websites sent the Firefox for Android tablet user agent to their desktop website.
There are two main options. Use the default display size setting in the Android display settings or in about:config create and set general.useragent.override to Mozilla/5.0 (Android; Mobile; rv:59.0) Gecko/59.0 Firefox/59.0 and increment the 59 values by one when Firefox does new releases. So in a few weeks when 60 is released it would be Mozilla/5.0 (Android; Mobile; rv:60.0) Gecko/60.0 Firefox/60.0.
Lire cette réponse dans son contexte 👍 1Toutes les réponses (6)
Hi, could you visit my test page and see what screen resolution is reported to the script in the page? You'll also see what the page estimates to be the true resolution based on the scaling setting.
Hi,
This is what is says:
JavaScript screen.width x screen.height = 486 x 971 window.devicePixelRatio = 2.2250001430511475 device pixels per CSS pixel Computed "true" screen.width x screen.height = 1081 x 2160
JavaScript window.innerWidth x window.innerHeight = 980 x 1684 window.devicePixelRatio = 2.2250001430511475 device pixels per CSS pixel Computed "true" window.innerWidth x window.innerHeight = 2181 x 3747
This is an unusual aspect ratio (16:8), but sites may have responsive CSS to adapt to it so let's ignore that for the moment.
Try overriding this setting:
(1) Open a new tab to about:config (type about:config in the Awesomebar and tap the go arrow or tap Enter).
You may want to bookmark this for easier future access.
(2) In the search box, type devp and pause while Firefox filters the list
(3) Tap the layout.css.devPixelsPerPx twice, and edit the value from -1.0 to 3.0 and tap the Enter/Return key.
In a different tab, reload the resolution test and see what is reported for JavaScript screen.width x screen.height
Expected: 360 x 720
Does that work better in triggering a mobile layout?
Still loads desktop primarily (even this site)
JavaScript screen.width x screen.height = 360 x 678 window.devicePixelRatio = 3 device pixels per CSS pixel Computed "true" screen.width x screen.height = 1080 x 2034
JavaScript window.innerWidth x window.innerHeight = 980 x 1587 window.devicePixelRatio = 3 device pixels per CSS pixel Computed "true" window.innerWidth x window.innerHeight = 2940 x 4761
Solution choisie
They have forced Firefox for Android into the tablet UI. This makes Firefox for Android use the tablet user agent. The tablet user agent is different from the mobile version. Most websites sent the Firefox for Android tablet user agent to their desktop website.
There are two main options. Use the default display size setting in the Android display settings or in about:config create and set general.useragent.override to Mozilla/5.0 (Android; Mobile; rv:59.0) Gecko/59.0 Firefox/59.0 and increment the 59 values by one when Firefox does new releases. So in a few weeks when 60 is released it would be Mozilla/5.0 (Android; Mobile; rv:60.0) Gecko/60.0 Firefox/60.0.
thanks to both of your help