Return to Snippet

Revision: 55325
at February 2, 2012 19:16 by denisko-redisko


Initial Code
var browser = (
    /*@cc_on!@*/ 0 ? 'msie' :
    window.chrome ? 'chrome' :
    window.opera ? 'opera' :
    window.MouseScrollEvent ? 'gecko' :
    window.WheelEvent ? 'safari' :
    'unknown'
);

alert(browser)

Initial URL


Initial Description
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.

Initial Title
Browser detection (is bad, absolutely, but)

Initial Tags


Initial Language
JavaScript