简单判断浏览器

来源:互联网 发布:matlab矩阵公式 编辑:程序博客网 时间:2024/06/15 09:26
<!DOCTYPE html><html>  <head>    <title>Zzhjs5.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><script type="text/javascript">function myBrowser(){var userAgent = navigator.userAgent;//if(userAgent.indexOf("Opera")>-1){return "Opera";}//火狐if(userAgent.indexOf("Firefox")>-1){return "Firefox";}//谷歌if(userAgent.indexOf("Chrome")>-1){return "Chrome";}//IEif(userAgent.indexOf("IE")>-1){return "IE";}//苹果浏览器if(userAgent.indexOf("Safari")>-1){return "Safari";}}function ondivclick(){alert(myBrowser());}</script>  </head>    <body>       <input type="button" value="查看浏览器类型" onclick="ondivclick()"/>  </body></html>

原创粉丝点击