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对象非常有用,因为您不仅可以获取有关浏览器类型和浏览器版本的信息,还可以获取有关用户的操作系统,浏览器插件和浏览器功能的信息。 让我向您展示如何使用浏览器对象检测浏览器功能!
检查浏览器和版本 (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对象? 分享它们,也许他们会成为对象!
mootools 选择器