mootools 选择器_MooTools 1.3浏览器对象

mootools 选择器

MooTools 1.3 was just released and one of the big additions is the Browser object.  The Browser object is very helpful in that not only do you get information about browser type and browser versions, you can gain information about the user's OS, browser plugins, and browser features.  Let me show you how you can use the Browser object to detect browser feature!

MooTools 1.3刚刚发布,最重要的功能之一是Browser对象。 Browser对象非常有用,因为您不仅可以获取有关浏览器类型和浏览器版本的信息,还可以获取有关用户的操作系统,浏览器插件和浏览器功能的信息。 让我向您展示如何使用浏览器对象检测浏览器功能!

MooTools Browser Detection

检查浏览器和版本 (Checking Browser and Version)


//check safari by property
if(Browser.safari) {  }

//check for ie by name
if(Browser.name == 'ie') {  }

//check for browser version
if(Browser.name == 'ie' && Browser.version == 7) {  }

//check for browser version by property
if(Browser.safari5) {  }


检查插件 (Checking for Plugins)


//check for Flash and version
if(Browser.Plugins.Flash && Browser.Plugins.Flash.version > 9) {  }


检查操作系统 (Checking for OS)


//check for windows by name
if(Browser.Platform.name == 'win') {  }

//check for mac by property
if(Browser.Platform.mac) {  }


检查浏览器功能 (Checking for Browser Features)


//check for ajax abilities
if(Browser.Features.xhr) {  }

//check if this is Adobe AIR
if(Browser.Features.air) {  }


The Browser object is a great utility for websites that rely on browser or feature presence, especially Flash or browser-specific functionality.  Have any other items you think should be added to the Browser object?  Share them and maybe they'll make it into the object!

对于依赖于浏览器或功能存在(尤其是Flash或特定于浏览器的功能)的网站,Browser对象是一个很棒的实用程序。 您是否还应该将其他任何项目添加到Browser对象? 分享它们,也许他们会成为对象!

翻译自: https://davidwalsh.name/mootools-browser

mootools 选择器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值