加载中...

jQuery.browser.version1.9-


概述    jQuery.browser.version

返回值:String

描述:用户的浏览器渲染引擎的版本号。

  • V : 1.1.3jQuery.browser.version

以下是一些典型的结果:

  • Internet Explorer: 6.0, 7.0, 8.0
  • Mozilla/Firefox/Flock/Camino: 1.7.12, 1.8.1.3, 1.9
  • Opera: 10.06, 11.01
  • Safari/Webkit: 312.8, 418.9

请注意,IE8兼容性视要求成为ie 7。

示例

实例

Returns the version number of the rendering engine used by the user's current browser. For example, FireFox 4 returns 2.0 (the version of the Gecko rendering engine it utilizes).

<!DOCTYPE html>
<html>
<head>
  <style>
  p { color:blue; margin:20px; }
  span { color:red; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
 
<p></p>
 
<script>
$("p").html( "The version number of the rendering engine your browser uses is: <span>" +
                $.browser.version + "</span>" );
</script>
 
</body>
</html>

运行一下

实例

Alerts the version of IE's rendering engine that is being used:

if ( $.browser.msie ) {
  alert( $.browser.version );
}

实例

Often you only care about the "major number," the whole number, which you can get by using JavaScript's built-in parseInt() function:

if ( $.browser.msie ) {
  alert( parseInt($.browser.version, 10) );
}


还没有评论.