Hi all - is there a way to get the browser name an...
# javascript
x
Hi all - is there a way to get the browser name and version from
jsMain
?
r
x
I see - i noticed we can use kotlin.browser.window type declaration to get
userAgent
but this string also contains additional information in the UA string. I ended up using
platform.js
using
Copy code
dependencies {
   implementation(npm("platform", "1.3.5"))
}
along with some external declarations
Copy code
@JsModule("platform")
external object Platform {
  val name: String // Chrome
  val version: String // 91.0.4472.77
}
And this worked like a treat 🧁