leaflet開源地圖庫源碼 瀏覽器&行動裝置判斷(browser.js)備份

來源:互聯網
上載者:User

標籤:

<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 參考地址

leaflet開源地圖庫源碼 瀏覽器&行動裝置判斷(browser.js)備份

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.