hgoebl / mobile-detect.js

Device detection (phone, tablet, desktop, mobile grade, os, versions)
http://hgoebl.github.io/mobile-detect.js/
MIT License
4.12k stars 892 forks source link

IE11 userAgent() doesn't return 'IE' #94

Closed virtualbjorn closed 5 years ago

virtualbjorn commented 5 years ago

Issue

[x] I've read above note and I'm quite sure I have a real issue with mobile-detect.js

Here's the userAgent string

Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Tablet PC 2.0; rv:11.0) like Gecko

I tried using the mobile-detect.min.js and failed to get userAgent(), it is just empty.

hgoebl commented 5 years ago

I suppose you haven't used the library as intended/documented. Please send the code where you instantiate (new) MobileDetect.

virtualbjorn commented 5 years ago
var mobileDetect = new MobileDetect(window.navigator.userAgent);
console.log(mobileDetect.userAgent()); // returns empty
console.log(mobileDetect.userAgents()); // returns [] also empty

btw, I'm using mobile-detect.min.js

hgoebl commented 5 years ago

this library works only for mobile environments. Most info (like userAgent) target mobile browsers.

See also #73