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

jQuery.browser

Contents:

jQuery.browser 返回: Map

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

  • version added: 1.0jQuery.browser

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

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

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

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

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

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: 用戶的瀏覽器渲染引擎的版本號(hào)。

  • 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

請(qǐng)注意,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月)
三亚市| 彩票| 桐城市| 陈巴尔虎旗| 中卫市| 东莞市| 司法| 孙吴县| 惠东县| 随州市| 项城市| 通州市| 泉州市| 台州市| 诏安县| 民和| 巴楚县| 清丰县| 龙海市| 上蔡县| 鄂托克旗| 东乌珠穆沁旗| 茂名市| 和林格尔县| 鸡东县| 弥渡县| 临武县| 沁源县| 十堰市| 耿马| 永城市| 兴海县| 惠安县| 三穗县| 洪泽县| 六安市| 万全县| 文成县| 衡南县| 榆中县| 双江|