Git Product home page Git Product logo

ua.examine's Introduction

UA.examine

Examine browser's userAgent.

Methods:

  • UA.examine.isIE() ---- 检测 IE ( 返回 Boolean 类型值 )
  • UA.examine.isIE( v ) ---- 检测 IE 版本< v: 版本号 > ( 返回 Boolean 类型值 )
  • UA.examine.isFirefox() ---- 检测 Firefox ( 返回 Boolean 类型值 )
  • UA.examine.isChrome() ---- 检测 Chrome ( 返回 Boolean 类型值 )
  • UA.examine.isSafari() ---- 检测 Safari ( 返回 Boolean 类型值 )
  • UA.examine.isOpera() ---- 检测 Opera ( 返回 Boolean 类型值 )
  • UA.examine.isSupportCanvas() ---- 检测浏览器是否支持 HTML5 Canvas ( 返回 Boolean 类型值 )
  • UA.userAgent() ---- 返回浏览器 User Agent 信息

用法( Usage ):

  • 在您的页面中装载 UA.examine.js:
<script type="text/javascript" src="UA.examine.js"></script>
  • 在您需要检测浏览器的代码中,调用相应的方法:
......
if( UA.examine.isIE() ){
    console.log( 'IE browser' );
}

if( UA.examine.isChrome() ){
    console.log( 'Chrome browser' );
}
......

Usage example:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="UA.examine.js"></script>
<title> UA.examine.js -- Usage example </title>
<!-- KILLHAPPY. 2013-07-20 -->
</head>

<body>
<script type="text/javascript">
<!--
var console = console || {
        log: function( s ){
            alert( s );
        }
    };

(function(){

    // Examine browser is IE
    if( UA.examine.isIE() ){
  
        console.log( 'IE browser' );
      
        // Examine browser is IE6.0
        if( UA.examine.isIE( 6 ) ){
            console.log( 'IE 6.0' );	
        }
      
        // Examine browser is IE7.0
        if( UA.examine.isIE( 7 ) ){
            console.log( 'IE 7.0' );	
        }
      
        // Examine browser is IE8.0
        if( UA.examine.isIE( 8 ) ){
            console.log( 'IE 8.0' );	
        }
      
        // Examine browser is IE9.0
        if( UA.examine.isIE( 9 ) ){
            console.log( 'IE 9.0' );	
        }
  
    }
  
    // Examine browser is Firefox
    if( UA.examine.isFirefox() ){		
        console.log( 'Firefox browser' );	
    }
  
    // Examine browser is Chrome
    if( UA.examine.isChrome() ){		
        console.log( 'Chrome browser' );	
    }
  
    // Examine browser is Safari
    if( UA.examine.isSafari() ){		
        console.log( 'Safari browser' );	
    }
  
    // Examine browser is Opera
    if( UA.examine.isOpera() ){		
        console.log( 'Opera browser' );	
    }

    // Examine browser whether support canvas
    if( UA.examine.isSupportCanvas() ){		
        console.log( 'Your browser support HTML5-canvas' );	
    }

})();
//-->
</script>

</body>
</html>

ua.examine's People

Contributors

graybobo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.