Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
anonymous-piwik-user opened this Issue · 4 comments

3 participants

Anonymous Piwik user Matthieu Aubry Anthon Pang
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.

Matthieu Aubry
Owner

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

Anthon Pang
Collaborator

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
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.