web/lib/device: add webkit browser detection

This commit is contained in:
wukko 2025-04-21 23:03:22 +06:00
parent 4182845e9a
commit 029934e580
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -16,6 +16,7 @@ const device = {
}, },
browser: { browser: {
chrome: false, chrome: false,
webkit: false,
}, },
prefers: { prefers: {
language: "en", language: "en",
@ -59,6 +60,12 @@ if (browser) {
device.browser = { device.browser = {
chrome: ua.includes("chrome/"), chrome: ua.includes("chrome/"),
webkit: ua.includes("applewebkit/")
&& ua.includes("version/")
&& ua.includes("safari/")
// this is the version of webkit that's hardcoded into chrome
// and indicates that the browser is not actually webkit
&& !ua.includes("applewebkit/537.36")
}; };
device.prefers = { device.prefers = {