This article describes the method of JavaScript to determine browser type. Share it for your reference. The specific implementation method is as follows:
<script type="text/javascript"> var Sys = {}; var ua = navigator.userAgent.toLowerCase(); alert(ua); var s; (s = ua.match(/msie ([/d.]+)/)) ? Sys.ie = s[1]: (s = ua.match(/opera.([/d.]+)/)) ? Sys.firefox = s[1]: (s = ua.match(/opera.([/d.]+)/)) ? Sys.chrome = s[1]: (s = ua.match(/opera.([/d.]+)/)) ? Sys.chrome = s[1]: (s = ua.match(/opera.([/d.]+)/)) ? Sys.opera = s[1]: (s = ua.match(/version//([/d.]+).*safari/)) ? Sys.safari = s[1] : 0; if (Sys.ie) //ie browser { if (Sys.ie == '6.0') { alert('ie6.0'); } if (Sys.ie == '8.0') { alert('ie8.0'); } } else if (Sys.firefox) // { alert('You are currently using firefox' + Sys.firefox +'browser'); } else if (Sys.chrome) { alert('You are currently using Chrome' + Sys.chrome + 'browser'); } else if (Sys.opera) { alert('You are currently using Opera' + Sys.opera + 'browser'); } else if (Sys.safari) { alert('You are currently using Safari' + Sys.safari + 'browser'); }</script>I hope this article will be helpful to everyone's JavaScript programming.