Opened 19 months ago

Closed 18 months ago

Last modified 18 months ago

#3416 closed Bug (fixed)

Detect Mobile scaled Resolution via window.devicePixelRatio

Reported by: old_bill Owned by:
Priority: normal Milestone: 1.9.2 - Piwik 1.9.2
Component: Core Keywords:
Cc: Sensitive: no

Description

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

Change History (6)

comment:1 Changed 19 months ago by vipsoft (robocoder)

  • Resolution set to answered
  • Status changed from new to closed

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.

comment:2 Changed 19 months ago by vipsoft (robocoder)

  • Resolution answered deleted
  • Status changed from closed to reopened

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.

Last edited 18 months ago by vipsoft (previous) (diff)

comment:3 Changed 19 months ago by old_bill

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

comment:4 Changed 18 months ago by matt (mattab)

  • Summary changed from iOS 6 / iPhone 5 User Agent to Detect Mobile scaled Resolution via window.devicePixelRatio

comment:5 Changed 18 months ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:6 Changed 18 months ago by vipsoft (robocoder)

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

Note: See TracTickets for help on using tickets.