Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #50 from cskr/master
Browse files Browse the repository at this point in the history
Detect Chrome for iOS correctly
  • Loading branch information
mssola authored Jan 15, 2019
2 parents 68da1a7 + 82f141d commit 7244ab0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ var uastrings = []struct {
ua: "Mozilla/5.0 (Linux; Android 4.2.1; Galaxy Nexus Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",
expected: "Mozilla:5.0 Platform:Linux OS:Android 4.2.1 Browser:Chrome-18.0.1025.166 Engine:AppleWebKit-535.19 Bot:false Mobile:true",
},
{
title: "Chrome for iOS",
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_3_1 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) CriOS/67.0.3396.87 Mobile/15E302 Safari/604.1",
expected: "Mozilla:5.0 Platform:iPhone OS:CPU iPhone OS 11_3_1 like Mac OS X Browser:Chrome-67.0.3396.87 Engine:AppleWebKit-604.1.34 Bot:false Mobile:true",
},
{
title: "WebkitNoPlatform",
ua: "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13",
Expand Down
2 changes: 2 additions & 0 deletions browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func (p *UserAgent) detectBrowser(sections []section) {
p.browser.Name = "Chrome"
} else if sections[sectionIndex].name == "Chromium" {
p.browser.Name = "Chromium"
} else if sections[sectionIndex].name == "CriOS" {
p.browser.Name = "Chrome"
} else {
p.browser.Name = "Safari"
}
Expand Down

0 comments on commit 7244ab0

Please sign in to comment.