How do we get the device native pixel density?

RESOLVED INACTIVE

Status

()

Core
DOM
RESOLVED INACTIVE
4 years ago
2 days ago

People

(Reporter: trusktr, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.1 Safari/537.36

Steps to reproduce:

Tried to find a way to get the device pixel density.


Actual results:

I don't see any way.


Expected results:

There should have been a way. There should be something like window.devicePixelDensity to report the hardware pixel density. Also, setting window.devicePixelRatio to 1 should make 1 CSS pixel be 1 physical pixel no matter what. Those two things would allow me to calculate, for example, the size of an inch on the screen.

Those two things would allow me to make true web *apps*.
Duplicate of this bug: 1103711
Component: Untriaged → DOM
Product: Firefox → Core
(Reporter)

Comment 2

3 years ago
Please, I beg of you, make this happen. Pleeease. I'm on my knees, begging.
(Reporter)

Comment 3

3 years ago
The web devs over at BlackBerry made this hack to be able to pseudo-set the devicePixelRatio: https://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-set-up-the-viewport-for-a-BlackBerry-WebWorks-application/ta-p/1943807

This is a step in the right direction (supposing the target browser supports that meta property), but if only a hack wasn't needed. Being able to set window.devicePixelRatio=1 would be nice.

And window.screen.density containing the device's native screen density would be nice too.

These types of things will make the web more appealing for "native" devs. They don't want to feel confined and restricted (like they do) when they visit the web world.

Comment 4

2 days ago
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 days ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.