<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1"> <!-- IE时使用最新的渲染,Chrome时激活Chrome Frame-->
  <meta name="renderer" content="webkit">   <!-- 为360浏览器的优化 -->
  <meta name="description" content="">
  <!-- start 解决缓存 -->
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="Expires" content="0">
  <!-- end 解决缓存 -->
  <meta name="format-detection" content="telephone=no"> <!-- 解决浏览器自动显示手机号问题 -->
  <link href="${staticPath}/image/favicon.png" rel="icon" type="image/x-icon"/>
  <title>Morgan Invest</title>
  <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
  <script>
    /* 安卓版本兼容 */
    var brower = {
      versions: function () {
        var u = window.navigator.userAgent;
        var num;
        if (u.indexOf('Trident') > -1) {
          //IE
          return "IE";
        } else if (u.indexOf('Presto') > -1) {
          //opera
          return "Opera";
        } else if (u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1) {
          //firefox
          return "Firefox";
        } else if ((u.indexOf('AppleWebKit') > -1) && (u.indexOf('Safari') > -1) && u.indexOf('Mobile') == -1) {
          //苹果、谷歌内核
          if (u.indexOf('Chrome') > -1) {
            //chrome
            return "Chrome";
          } else if (u.indexOf('OPR')) {
            //webkit Opera
            return "Opera_webkit"
          } else {
            //Safari
            return "Safari";
          }
        } else if (u.indexOf('Mobile') > -1) {
          //移动端
          if (!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
            //ios
            if (u.indexOf('iPhone') > -1) {
              //iphone
              return "iPhone"
            } else if (u.indexOf('iPod') > -1) {
              //ipod
              return "iPod"
            } else if (u.indexOf('iPad') > -1) {
              //ipad
              return "iPad"
            }
          } else if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
            //android
            num = u.substr(u.indexOf('Android') + 8, 3);
            return {"type": "Android", "version": num};
          } else if (u.indexOf('BB10') > -1) {
            //黑莓bb10系统
            return "BB10";
          } else if (u.indexOf('IEMobile')) {
            //windows phone
            return "Windows Phone"
          }
        }
      }
    }
 
    $(document).ready(function () {
      $("#div1").html(window.navigator.userAgent);
 
      $("#but1").on("click", function () {
        var browerName = brower.versions();
        if (browerName instanceof String) {
          $("#div2").html("This Browser is: " + browerName);
        } else if (browerName instanceof Object) {
          $("#div2").html("This Browser is: " + "Type-" + browerName.type + " Version-" + browerName.version);
        } else {
          $("#div2").html("This Browser is: " + browerName);
        }
 
        if (window.navigator.userAgent.indexOf('Mobile') > -1) {
          $("#div3").html("It's mobile device");
        } else {
          $("#div3").html("It's PC device");
        }
      });
    });
  </script>
</head>
<body>
 
<div id="div1" style="color:#00ff00"></div>
<button id="but1">Display User Agent</button>
<div id="div2" style="color:#0000ff"></div>
<div id="div3" style="color:#ff0000"></div>
 
</body>
</html>