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

Detect Chrome for iOS correctly #50

Merged
merged 1 commit into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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