Skip to content
Merged
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
18 changes: 13 additions & 5 deletions lib/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ type DeviceInfo = {

function getOSAndName(): DeviceInfo {
const parser = new UAParser();
const result = parser.getResult();
const {browser, os} = parser.getResult();

let osVersion = os.version;
// Detection logic inspired by UAParser guide on iOS 26:
// https://docs.uaparser.dev/guides/how-to-detect-ios-26-using-javascript.html
if (browser.name === 'Mobile Safari' && browser.major === '26' && os.name === 'iOS' && os.version === '18.6') {
Copy link
Contributor

@inimaga inimaga Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we are hardcoding to 18.6? What if we parsed it and tried to match all variants of ios18 (Not just 18.6)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaah Gotcha. Thanks for the link. @dmkt9 Mind including a short clarifying comment then, for posterity.

osVersion = '26';
}

return {
os: result.os.name,
osVersion: result.os.version,
deviceName: result.browser.name,
deviceVersion: result.browser.version,
os: os.name,
osVersion,
deviceName: browser.name,
deviceVersion: browser.version,
};
}

Expand Down