-
Notifications
You must be signed in to change notification settings - Fork 106
Requirements
Filipe Fortes edited this page Jan 11, 2011
·
2 revisions
Capability testing flags that can be used for better targeting content and UI to the browser.
Like Modernizr, Treesaver adds CSS classes onto the <html> element. For example, if the browser supports @font-face syntax, but does not support the canvas element, the document root will have the following class attribute:
<html class="fontface no-canvas">You can use this in order to target CSS based on browser capabilities:
.fontface h1 {
font-family: "My Custom Font";
}
.no-fontface h1 {
font-family: Arial;
}jscanvaslocalstoragevideoapplicationcachefontfacecsstransformscsstransforms3dcsstransitions
-
treesaver: Whether the browser supports treesaver -
microdata: Whether the browser has native HTML5 microdata support -
flash: Whether the browser has Flash support (either native or via plugin) -
legacy: Indicates an older generation of browsers such as IE7 and Firefox 3.5 -
mobile: Whether the user agent indicates a mobile browser -
smallscreen: Screen size (not window size) less than 600px wide -
cached: Was the page loaded from the applicationCache? -
offline: Is the browser currently offline? -
orientation: Whether device orientation can be detected -
orientation-vertical: Current orientation -
orientation-horizontal: Current orientation -
browser-xxx: Where xxx is one ofmsie,chrome,safari,webkit,mozilla,opera, orunknown -
os-xxx: Where xxx is one of:win,mac,linux,iphone,ipad,ipod,android, orunknown
Some capabilities may change after the page has loaded:
-
orientation-vertical/orientation-horizontal: Changes when the user rotates the device -
offline: Changes with browser status