Skip to content

fix: Wrong OS Identification In Vivaldi Browser#158

Open
bytrangle wants to merge 1 commit intosteipete:mainfrom
bytrangle:fix_wrong-os-identification-in-vivaldi
Open

fix: Wrong OS Identification In Vivaldi Browser#158
bytrangle wants to merge 1 commit intosteipete:mainfrom
bytrangle:fix_wrong-os-identification-in-vivaldi

Conversation

@bytrangle
Copy link
Contributor

@bytrangle bytrangle commented Mar 16, 2026

Problem Description

When I installed the extension for Vivaldi browser, the token was not generated and I got error "Not supported on this OS yet". That's unexpected, since I'm using Linux and Vivaldi runs on Chromium. I thought the extension should have been able to identify the OS in Vivaldi.

When I install the extension for Chrome, the token was generated.

So the problem probably lied with Vivaldi.

What Happened Under The Hood

When installing an extension in Vivaldi and inspecting the html page, the window.navigator.userAgentData has these values:

{
  brands: [],
  mobile: false,
  platform: ""
}

The resolvePlatform function uses a nullish coalescing operator, so userAgentData.platformas an empty string is not null and it still gets used.

const raw = (nav.userAgentData?.platform ?? navigator.platform ?? navigator.userAgent ?? "")
    .toLowerCase()
    .trim();

  if (raw.includes("mac")) return "mac";
  if (raw.includes("win")) return "windows";
  if (raw.includes("linux") || raw.includes("cros") || raw.includes("chrome os")) return "linux";
  return "other";

So in the end resolvePlatform returns other.

Please note that userAgentData.platform only returns an empty string in the extension context. If you open a normal web page in Vivaldi and access userAgentData.platform, it will return the same values as Chrome.

What Were Changed

Ensure that userAgentData.platform is not only defined but also not empty. If it is, fall back to navigator.platform, then navigator.userAgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant