/ Published in: JavaScript
Browser detection is bad, absolutely.
But sometimes you need to display the inscription "you are using Opera browser" (or Chrome, FF, MSIE, Safari), or display the icon. You also need not be deceived if the user sets in the properties of "Mask as " a different browser.
But sometimes you need to display the inscription "you are using Opera browser" (or Chrome, FF, MSIE, Safari), or display the icon. You also need not be deceived if the user sets in the properties of "Mask as " a different browser.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var browser = ( /*@cc_on!@*/ 0 ? 'msie' : window.chrome ? 'chrome' : window.opera ? 'opera' : window.MouseScrollEvent ? 'gecko' : window.WheelEvent ? 'safari' : 'unknown' ); alert(browser)