bowser-js / bowser

a browser detector
Other
5.52k stars 487 forks source link

getBrowserName() undefined #485

Open psxpa3 opened 3 years ago

psxpa3 commented 3 years ago

Hello,

I am working on upgrading "bowser" from 1.9.4 -> 2.11.0; however, getting the following error - "getBowserName() does not exist for undefined". Here the undefined is the return value of getParser(). const browser = Bowser.getParser(window.navigator.userAgent); I am using this "browser" object to retrieve browser (firefox etc), however, not able to proceed.

Previously the codebase had these statements to access the browser which was working properly.

import * as Bowser from "bowser"; (Bowser.browser === "firefox")

"typescript": "3.9.9"

I have followed the steps mentioned on the documentation - https://www.npmjs.com/package/bowser. Not sure how to resolve this error. Any help would be highly appreciated. If any other information is needed from my end, then please let me know.