Open Bug 1103707 Opened 6 years ago Updated 2 years ago

How do we get the device native pixel density?


(Core :: DOM: Core & HTML, defect, P5)






(Reporter: trusktr, Unassigned)



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
Please, I beg of you, make this happen. Pleeease. I'm on my knees, begging.
The web devs over at BlackBerry made this hack to be able to pseudo-set the devicePixelRatio:

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.

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.