Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Mobile scaled Resolution via window.devicePixelRatio #3416

Closed
anonymous-matomo-user opened this issue Oct 3, 2012 · 6 comments
Closed
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

Piwik currently has an issue with correctly detecting an iPhone 5 and shows a wrong display size in the logs:

iPhone / Safari / 320x568

The correct size would be 1136 x 640px.

Find the iPhone5 user agent string below:

Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A405 Safari/8536.25
@robocoder
Copy link
Contributor

The screen resolution is captured by Piwik.js. It doesn't look at the user agent, so it has no way of knowing that Mobile Safari is lying.

@robocoder
Copy link
Contributor

We could use window.devicePixelRatio to scale the resolution.

But I loathe using Apple's window.orientation or orientationchange event when other browsers are supporting the draft standard deviceorientation event.

@anonymous-matomo-user
Copy link
Author

By the way, the same goes for the iPad 3, which is recognized with 768x1024 while it is 2048 x 1536px actually.

@robocoder
Copy link
Contributor

(In [7319]) fixes #3416 - scale resolution by window.devicePixelRatio on Safari iOS/Mac OS X

@robocoder
Copy link
Contributor

(In [7329]) refs #3416, fixes #3496 - fix RegExp typo; thanks pebosi

@mattab
Copy link
Member

mattab commented Jul 13, 2016

FYI change reverted in #10296 (comment) as applying the device pixel ratio resulted in resolution incorrectly stored.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants