发布于 2015-08-12 16:11:05 | 1465 次阅读 | 评论: 0 | 来源: 网络整理

检测方法

Detect module

该检测方法可以再不同的环境中微调你的站点或者应用程序,并帮助你识别手机和平板;以及不同的浏览器和操作系统。

// The following boolean flags are set to true if they apply,
        // if not they're either set to `false` or `undefined`.
        // We recommend accessing them with `!!` prefixed to coerce to a boolean. 

        // general device type
        $.os.phone
        $.os.tablet

        // specific OS
        $.os.ios
        $.os.android
        $.os.webos
        $.os.blackberry
        $.os.bb10
        $.os.rimtabletos

        // specific device type
        $.os.iphone
        $.os.ipad
        $.os.touchpad
        $.os.kindle

        // specific browser
        $.browser.chrome
        $.browser.firefox
        $.browser.silk
        $.browser.playbook

        // Additionally, version information is available as well.
        // Here's what's returned for an iPhone running iOS 6.1.
        !!$.os.phone         // => true
        !!$.os.iphone        // => true
        !!$.os.ios           // => true
        !!$.os.version       // => "6.1"
        !!$.browser.version  // => "536.26"
    
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务