Note:
Izzy's answer explains us that the issue is most likely the responsive design of the website, a design which can disregard the user-agent and ultimately, the choice of the user too.
The responsive design adjusts the UI of the website based on the dimension of the browser's window. That is, on desktop, if you open www.cs.princeton.edu/research/areas or android.izzysoft.de/articles.php (both website uses responsive design) in a new window and adjusts the size of the window using mouse or shortcuts, you will witness the transition of the design from Desktop-to-Tablet-to-Mobile.
This behavior implies that the website considers the dimensions of the browser window to be the true dimension of the screen.
In Firefox, the remedy from this behavior is to change the value of the key layout.css.devPixelsPerPx
. You can do so by typing about:config
in the URL bar followed by searching layout.css.devPixelsPerPx
. The default would be set to -1.0. Double tap on the value to edit it.
Per Arch wiki's Firefox Tweaks and this answer by jscher2000 on Mozilla Support , changing the value to 1.0 would be equivalent to having a screen of 96 DPI (your POV may differ), a DPI often found in monitors. Tweak the value to 1.0 or 2.0 or even from a range of -1.0 to 1.0. Be very cautious when using a value to less than 1.0 on fullHD or ultraHD smartphones since the font size may become illegible.
I found 1.0 for my 5.5" fullHD decice and 0.4 for my 5.0" non-HD device the best values for Desktop mode.
Example screenshots:
- First image: default value to -1.0
- Second image: value to 1.0 for my fullHD device
- Third image: value to 0.4 for my non-HD device
(Click image to enlarge)

Drawbacks
- The effect of the tweak is universal, hence, every site would show up in Desktop layout or the layout you chose to, until you revert the value to -1.0.
- Some websites may rely on the user-agent too, hence changes in both may be required.
Ease for rooted devices
If you constantly need to access some particular websites with responsive design, but only in Desktop mode, to-and-fro to about:config
can be pretty much tiresome.
In that case, you can use these flexible commands:
(Requires BusyBox installed)
Change the layout to Desktop
am force-stop org.mozilla.firefox; sleep 1; sed -i '$auser_pref("layout.css.devPixelsPerPx", "1.0");' /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js; monkey -p org.mozilla.firefox 1
Here:
am
: activity manager; is force-stopping the Firefox, otherwise, the changes wouldn't take effect
sleep
: wait for n seconds before further execution; needed for some old and slow devices, like mine
sed
: a stream editor; is adding the configuration that would set the layout to Desktop. 1.0
should be replaced by the value you ended up in last section.
Note that mentioning /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js
will cause the changes to take place in every Firefox profile. To make the command profile specific, replace *.default
with the name of the profile directory.
monkey
: while meant for stress testing an app, it is helping us to launch the launcher activity of Firefox
Back to default mobile layout
am force-stop org.mozilla.firefox; sleep 1; sed -i '/.*layout.css.devPixelsPerPx.*/d' /data/data/org.mozilla.firefox/files/mozilla/*.default/prefs.js; monkey -p org.mozilla.firefox 1
We're simply deleting the line having the layout configuration.
Real world usage
How you would practically use the two commands from last section is completely up to you.
I can recommend:
LMT Launcher. It has the option to assign a script to a Pie (see example). Under the script you can copy-paste the whole command. It can also assign an app shortcut to a Pie, so you can use it with Tasker or MacroDroid or Secure Settings. The latter apps can execute your commands.
GMD GestureControl. Use gestures to control the device, or for our case, execute our commands. For basic details and usage, see my answer here and here. You would need a third-party app like Tasker or Secure Settings for the command execution part.
- All in one Gestures. This app can also control the device using gestures. Alike the last app, third-party support is required for command execution. If needed, see my answer for very basic info.
- GravityBox. A magical box perhaps. You can use it to show a Pie which would execute your command on tap, or add a custom tile in the Quick Settings bar (see example). For usage, see the first section of my answer here.
- Overlays - Float Everywhere. Reminds me of this example (Image source) where you can add stuff into a global, hidden but on-request available, sidebar. Again, you would need a third-part app to execute your commands. For usage, see the official website or my answer here.
Note: