📜  如何检测 Safari、Chrome、IE、Firefox 和 Opera 浏览器? - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:29.199000             🧑  作者: Mango

代码示例1
Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it's trivial to spoof this value.
I've written a method to detect browsers by duck-typing.

Only use the browser detection method if it's truly necessary, such as showing browser-specific instructions to install an extension. Use feature detection when possible.

Demo: https://jsfiddle.net/6spj1059/