mobileDetect.js

/**
 * MobileDetect.system          ios || android
 */
var MobileDetect = {
    init: function() {
        this.system = this.info();
    },
    info: function() {
        return function() {
            var u = navigator.userAgent;
            if (u.match(/(iPad|iPhone)/i)) {
                return 'ios';
            }
            if (u.match(/(Android)/i)) {
                return 'android';
            }
        } ();
    }
};
MobileDetect.init();
原文地址:https://www.cnblogs.com/shanchenba/p/5567349.html