Library method
suggest changeAn easier approach for some would be to use an existing JavaScript library. This is because it can be tricky to guarantee browser detection is correct, so it can make sense to use a working solution if one is available.
Bowser is a browser-sniffing library, not a feature test. The properties below (msie, version, iphone) match Bowser 1.x. Bowser 2 returns a parser, and those properties are not on the module object. The repository moved from ded/bowser.
Usage example:
if (bowser.msie && bowser.version >= 6) {
alert('IE version 6 or newer');
}
else if (bowser.firefox) {
alert('Firefox');
}
else if (bowser.chrome) {
alert('Chrome');
}
else if (bowser.safari) {
alert('Safari');
}
else if (bowser.iphone || bowser.android) {
alert('iPhone or Android');
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents