vanminhquangtri
vanminhquangtri

Reputation: 335

navigator.userAgent in Chrome not correct

I use javascript method navigator.userAgent to detect version of browser. But it gives wrong version for Chrome. My Chrome is 114.0.5735.134, but the navigator.userAgent show it is 114.0.0.0. I would be grateful if some body can give me advice on how to fix this? Thank you. enter image description here

enter image description here

Upvotes: -1

Views: 868

Answers (2)

kapil
kapil

Reputation: 1

To use find-chrome-version:

import findChromeVersion from "find-chrome-version"

const example = async () => {
  const chromeVersion = await findChromeVersion()
  console.log(`Your Chrome version is ${chromeVersion}`)
}

Upvotes: -2

vanminhquangtri
vanminhquangtri

Reputation: 335

At least for Chrome, there's library name: find-chrome-version. This would give you the exact version of Chrome. https://www.npmjs.com/package/find-chrome-version

Upvotes: -1

Related Questions