Skip to content

Instantly share code, notes, and snippets.

@ryochin
Created July 1, 2019 05:51
Show Gist options
  • Save ryochin/2292c94f4ec347ace4ab3e46ab067aee to your computer and use it in GitHub Desktop.
Save ryochin/2292c94f4ec347ace4ab3e46ab067aee to your computer and use it in GitHub Desktop.
IE detection in TypeScript
import * as _ from 'lodash'
import * as Bowser from 'bowser'
isIE(): boolean {
const browser: Bowser.Parser.Parser = Bowser.getParser(window.navigator.userAgent)
const result: boolean | undefined = browser.satisfies({
windows: {
'internet explorer': '>0'
}
})
return _.isUndefined(result) ? false : result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment