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

Commit 42e4a8f

Browse files
committed
Fix detection of Firefox on iPad
Signed-off-by: Bruno Michel <bruno@cozycloud.cc>
1 parent 8ecdab5 commit 42e4a8f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Not yet published
4+
5+
- Fix detection of Firefox on iPad.
6+
37
## 0.5.2
48

59
- Detect Electron. See [commit](https://github.com/mssola/user_agent/commit/1a36963d74c0efca7de80dc7518a0958c66b3c4f).

all_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,11 @@ var uastrings = []struct {
571571
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/7.0.4 Mobile/16B91 Safari/605.1.15",
572572
expected: "Mozilla:5.0 Platform:iPhone OS:CPU iPhone OS 12_1 like Mac OS X Browser:Firefox-7.0.4 Engine:AppleWebKit-605.1.15 Bot:false Mobile:true",
573573
},
574+
{
575+
title: "Firefox on iPad",
576+
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/24.1 Safari/605.1.15",
577+
expected: "Mozilla:5.0 Platform:iPad OS:Intel Mac OS X 10.15 Browser:Firefox-24.1 Engine:AppleWebKit-605.1.15 Bot:false Mobile:true",
578+
},
574579
{
575580
title: "Electron",
576581
ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) CozyDrive/3.17.0 Chrome/73.0.3683.119 Electron/5.0.0 Safari/537.36",

operating_systems.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ func webkit(p *UserAgent, comment []string) {
116116
}
117117
}
118118
}
119+
120+
// Special case for Firefox on iPad, where the platform is advertised as Macintosh instead of iPad
121+
if p.platform == "Macintosh" && p.browser.Engine == "AppleWebKit" && p.browser.Name == "Firefox" {
122+
p.platform = "iPad"
123+
p.mobile = true
124+
}
119125
}
120126

121127
// Guess the OS, the localization and if this is a mobile device

0 commit comments

Comments
 (0)