cross browser - IE9 devicePixelRatio equivalent -



cross browser - IE9 devicePixelRatio equivalent -

has discovered reliable method determine device pixel ratio windows phone 7.5 (mango).

it based off of ie9. in webkit based browsers have window.devicepixelratio or using window.matchmedia() appropriate media query.

in windows mobile can determine pixel ratio doing: screen.devicexdpi / screen.logicalxdpi though appears reliable 1 time page has been rendered. prior devicexdpi reports same logicalxdpi

has found solution?

thanks help/suggestions

use (min/max-)resolution equivalent test in media query:

@media (min-resolution: 1.5dppx), (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2) {}

or through matchmedia:

if (window.matchmedia) { if (window.matchmedia('(resolution: 96dpi)').matches) { } // resolution feature & dppx unit if (window.matchmedia('(min-resolution: 1dppx)').matches) { } // -webkit-device-pixel-ratio feature if (window.matchmedia('(-webkit-min-device-pixel-ratio: 1)').matches) { } // -o-device-pixel-ratio feature if (window.matchmedia('(-o-min-device-pixel-ratio: 1/1)').matches) { } }

references

msdn - resolution media feature

css wg blog – how unprefix -webkit-device-pixel-ratio

cross-browser internet-explorer-9 media-queries porting dpi

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -