最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jQuery.browser

Contents:

jQuery.browser 返回: Map

描述: 我們不推薦使用這個屬性,請嘗試使用功能檢測來代替(見jQuery.support)。用來獲取useragent的包含標(biāo)志,讀取 navigator.userAgent。雖然jQuery.browser不會從jQuery的未來版本被刪除,竭力推薦應(yīng)采用jQuery.support和適當(dāng)?shù)奶卣鳈z測。

  • version added: 1.0jQuery.browser

$.browser屬性允許我們檢測哪一個Web瀏覽器正在訪問網(wǎng)頁,通過瀏覽器本身返回。它包含四個最流行的瀏覽器類(在Internet Explorer,Mozilla和Webkit,和Opera)以及每個版本信息標(biāo)志。

可用的標(biāo)志有:

  • webkit (as of jQuery 1.4)
  • safari (deprecated)
  • opera
  • msie
  • mozilla

此屬性是即刻有效的。因此,安全地使用它來判斷是否要調(diào)用$(document).ready()。在jQuery 1.3中,$.browser屬性是不贊成使用的,但目前還沒有計劃立即將其刪除。

因?yàn)?code>$.browser使用navigator.userAgent來確定平臺,它是容易被用戶或?yàn)g覽器本身的失實(shí)陳述欺騙。$.support屬性比$.browser提供更有效的檢測特定功能的支持。

Examples:

Example: Show the browser info.

<!DOCTYPE html>
<html>
<head>
  <style>
  p { color:green; font-weight:bolder; margin:3px 0 0 10px; }
  div { color:blue; margin-left:20px; font-size:14px; }
  span { color:red; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <p>Browser info:</p>
<script>
    jQuery.each(jQuery.browser, function(i, val) {
      $("<div>" + i + " : <span>" + val + "</span>")
                .appendTo(document.body);
    });</script>

</body>
</html>

Demo:

Example: Returns true if the current useragent is some version of Microsoft's Internet Explorer.

$.browser.msie

Example: Alerts "this is webkit!" only for webkit browsers

if ($.browser.webkit) {
    alert("this is webkit!");
 }

Example: Alerts "Do stuff for firefox 3" only for firefox 3 browsers.

jQuery.each(jQuery.browser, function(i, val) {
   if(i=="mozilla" && jQuery.browser.version.substr(0,3)=="1.9")
      alert("Do stuff for firefox 3")
 });

Example: Set a CSS property to specific browser.

jQuery.each(jQuery.browser, function(i) {
   if($.browser.msie){
      $("#div ul li").css("display","inline");
   }else{
      $("#div ul li").css("display","inline-table");
   }
 });

jQuery.browser.version Returns: String

Description: 用戶的瀏覽器渲染引擎的版本號。

  • version added: 1.1.3jQuery.browser.version

以下是一些典型的結(jié)果:

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

請注意,IE8兼容性視要求成為ie 7。 Note that IE8 claims to be 7 in Compatibility View.

Examples:

Example: Returns the browser version.

<!DOCTYPE html>
<html>
<head>
  <style>
  p { color:blue; margin:20px; }
  span { color:red; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <p>
  </p>
<script>

    $("p").html("The browser version is: <span>" +
                jQuery.browser.version + "</span>");
</script>

</body>
</html>

Demo:

Example: Alerts the version of IE that is being used

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

Example: Often you only care about the "major number," the whole number. This can be accomplished with JavaScript's built-in parseInt() function:


if (jQuery.browser.msie) {
  alert(parseInt(jQuery.browser.version));
}
jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
云南省| 达日县| 灵丘县| 葫芦岛市| 冀州市| 万载县| 新津县| 措美县| 同德县| 玛沁县| 和平县| 顺昌县| 嵊州市| 循化| 潢川县| 桐庐县| 南木林县| 日土县| 金门县| 阿瓦提县| 汉源县| 滁州市| 青龙| 福安市| 龙山县| 区。| 铁力市| 兰坪| 松原市| 出国| 金寨县| 望奎县| 卢氏县| 松潘县| 高台县| 静乐县| 织金县| 安泽县| 宝丰县| 五家渠市| 龙口市|