UserAgent detection inside iOS App (UIWebView) gives the wrong version number #3753

Closed
anonymous-piwik-user opened this Issue Feb 14, 2013 · 4 comments

3 participants

@anonymous-piwik-user

When a visitor comes from inside an iOS App (when a page is loaded into a UIWebView), Piwik detects the Browser as Safari, but the Version is detected wrong.

iOS 5.x: Safari 5.0 (should be 5.1)
iOS 6.x: Safari 5.1 (should be 6.0)

Safari and UIWebView give mostly the same User Agent, but UIWebView is missing
Version/*
and
Safari/*
.

I think this is the reason that

iOS 5.0
UIWebView: Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A334
Safari:    Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3

iOS 5.1
UIWebView: Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176
Safari:    Mozilla/5.0 (iPhone Simulator; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3

iOS 6.0
UIWebView: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10A403
Safari:    Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25

iOS 6.1
UIWebView: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B141
Safari:    Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B141 Safari/8536.25
@anonymous-piwik-user

I will try to fix this and submit a pull request on github.

@mattab
Piwik Open Source Analytics member

THanks for providing a fix. Also please update unit tests UserSettingsTest

@robocoder

In 688f171: fix #3753 - fix UserAgent detection for UIWebView

@anonymous-piwik-user

In 961b558: fix #3753 - fix UserAgent detection for UIWebView

@anonymous-piwik-user anonymous-piwik-user added this to the 1.11 - Piwik 1.11 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment