How to target Windows 10 Edge browser with javascript -
i know should feature detection possible, can detect in javascript if browser microsoft edge browser?
i maintain old product , want display warning features broken without having invest lot of time fixing old code.
try detect features instead of specific browser. it's more future-proof. should user browser detection.
with out of way: 1 option use library (there many intricacies user agent strings), or alternatively parse window.navigator.useragent
manually.
using parser library
# https://github.com/faisalman/ua-parser-js. var parser = new uaparser(); var result = parser.getresult(); var name = result.browser.name; var version = result.browser.version;
raw javascript approach
# mozilla/5.0 (windows nt 10.0) applewebkit/537.36 (khtml, gecko) \ # chrome/42.0.2311.135 safari/537.36 edge/12.10136 window.navigator.useragent.indexof("edge") > -1
Comments
Post a Comment