加载中...

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).

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p { color:blue; margin:20px; }
  6. span { color:red; }
  7. </style>
  8. <script src="http://code.jquery.com/jquery-latest.js"></script>
  9. </head>
  10. <body>
  11. <p></p>
  12. <script>
  13. $("p").html( "The version number of the rendering engine your browser uses is: <span>" +
  14. $.browser.version + "</span>" );
  15. </script>
  16. </body>
  17. </html>

运行一下

实例

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

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

实例

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

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


还没有评论.