leafletオープンソースマップライブラリソースブラウザ&モバイルデバイス判定(browser.js)バックアップ

3423 ワード

<script>

   var isIe = !-[1,];

  // alert('ie9  '+isIe);

   var ie = 'ActiveXObject' in window;

   //alert('sadsd'+ie);

   var ie2 = !!('ActiveXObject' in window);

   //alert('22222'+ie2);

   var ie3= !!window.ActiveXObject || !!("ActiveXObject" in window);   //!!window['ActiveXObject']   3 

// alert(ie3);

 

 var doc = document.documentElement;

 console.log(doc.style+' ');

 ;(function () {



    var ua = navigator.userAgent.toLowerCase(),//var ua = navigator.userAgent.toLowerCase(); //window.navigator.userAgent, UA , 。 , chrome 。

        doc = document.documentElement,



        ie = 'ActiveXObject' in window,



        webkit    = ua.indexOf('webkit') !== -1,  // ///retina 

        phantomjs = ua.indexOf('phantom') !== -1,

        android23 = ua.search('android [23]') !== -1,   //// android 2.3 

        chrome    = ua.indexOf('chrome') !== -1,



        mobile = typeof orientation !== 'undefined',

        msPointer = navigator.msPointerEnabled && navigator.msMaxTouchPoints && !window.PointerEvent,

        pointer = (window.PointerEvent && navigator.pointerEnabled && navigator.maxTouchPoints) || msPointer,



        ie3d = ie && ('transition' in doc.style),

        webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23,

        gecko3d = 'MozPerspective' in doc.style,

        opera3d = 'OTransition' in doc.style;



   ///retina 

    var retina = 'devicePixelRatio' in window && window.devicePixelRatio > 1;



    if (!retina && 'matchMedia' in window) {

        var matches = window.matchMedia('(min-resolution:144dpi)');

        retina = matches && matches.matches;

    }

    

	

	/// :

    var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||

            (window.DocumentTouch && document instanceof window.DocumentTouch));



    L.Browser = {

        ie: ie,

        ielt9: ie && !document.addEventListener,

        webkit: webkit,

        gecko: (ua.indexOf('gecko') !== -1) && !webkit && !window.opera && !ie,

        android: ua.indexOf('android') !== -1,

        android23: android23,

        chrome: chrome,

        safari: !chrome && ua.indexOf('safari') !== -1,



        ie3d: ie3d,

        webkit3d: webkit3d,

        gecko3d: gecko3d,

        opera3d: opera3d,

        any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs,



        mobile: mobile,

        mobileWebkit: mobile && webkit,

        mobileWebkit3d: mobile && webkit3d,

        mobileOpera: mobile && window.opera,



        touch: !!touch,        //!!   

        msPointer: !!msPointer,

        pointer: !!pointer,



        retina: !!retina

    };



}());

</script>

ソースコードがはっきりしている。バックアップはいいですね。


http://www.cnblogs.com/vczero/p/leaflet_3.html参照アドレス