July 2011
Intermediate to advanced
276 pages
5h 11m
English
MooTools is cross-browser compliant, but CSS is not always as nice; let's figure out what browser is visiting us.
Create a string that has browser and platform particulars in it.
var browser_info = 'Your browser info: '+ Browser.name+' '+ Browser.version+' on '+ Browser.Platform.name;
MooTools works regular expression magic on the navigator.userAgent. See this snippet from the source:
var ua = navigator.userAgent.toLowerCase(), platform = navigator.platform.toLowerCase(), UA = ua.match(/(opera|ie|firefox|chrome|version)[s/:]([wd.]+)?.*?( safari|version[s/:]([wd.]+)|$)/) || [null, 'unknown', 0], mode = UA[1] == 'ie' && document.documentMode; var Browser = this.Browser = { ...