//判断是否是手机
    function IsMobile() {
        var isMobile = {
            Android: function () {
                return navigator.userAgent.match(/Android/i) ? true : false;
            },
            BlackBerry: function () {
                return navigator.userAgent.match(/BlackBerry/i) ? true : false;
            },
            iOS: function () {
                return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false;
            },
            Windows: function () {
                return navigator.userAgent.match(/IEMobile/i) ? true : false;
            },
            any: function () {
                return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows());
            }
        };

        return isMobile.any(); //是移动设备
    }

 

相关文章:

  • 2021-12-18
  • 2021-12-28
  • 2022-12-23
  • 2021-08-28
  • 2022-02-23
  • 2022-12-23
猜你喜欢
  • 2021-12-04
  • 2021-12-04
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案