MSIE、Chrome、Safari等のブラウザで以下のJavascriptを表示すると、画面にブラウザの種類とバー上を表示します。
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <script type="text/javascript" language="JavaScript">// <![CDATA[ myAgent = ""; function myGetVer( myKey ){ myStart = myAgent.indexOf( myKey ) + myKey.length; myEnd = myAgent.indexOf( ";", myStart ); return "Ver." + myAgent.substring ( myStart, myEnd ); } function mySearch( myKey ){ return (myAgent.indexOf( myKey )>=0) ? true : false; } function myFunc( myUserAgent ){ myAgent = myUserAgent + ";"; myAgent = myAgent.replace( / /g, ";" ); // Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.14 if ( mySearch( "Opera/" ) ) myVer = "Opera " + myGetVer( "Opera/" ); // Mozilla/5.0 (Windows NT 6.0; rv:19.0) Gecko/20100101 Firefox/19.0 else if ( mySearch( "Firefox" ) ) myVer = "Firefox " + myGetVer( "Firefox/" ); // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.99 Safari/537.22 else if ( mySearch( "Chrome" ) ) myVer = "Google Chrome " + myGetVer( "Chrome/" ); // Mozilla/5.0 (Linux; U; Android 4.1.2; ja-jp; F-02E Build/V16R46A) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 // Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25 else if ( mySearch( "Mobile" ) && mySearch( "Safari" ) && mySearch( "Version" ) ) myVer = "Mobile Safari " + myGetVer( "Version/" ); // Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.28.10 (KHTML, like Gecko) Version/6.0.3 Safari/536.28.10 else if ( mySearch( "Safari" ) && mySearch( "Version" ) ) myVer = "Safari " + myGetVer( "Version/" ); // Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0; Touch; MAFSJS) else if ( mySearch( "MSIE;" ) ) myVer = "Internet Explorer " + myGetVer( "MSIE;" ); else myVer = navigator.appName; return myVer; } myParam = navigator.userAgent; document.write( "あなたのブラウザは、" , myFunc( myParam ) , " です" ); // ]]></script>