CssUserAgent
Looking for JsonFx?
Both the full framework and JSON Serializer are available:
JsonFx StarterKit
For code examples and detailed feature descriptions visit:
This page demonstrates the power of CssUserAgent. This feature applies User-Agent specific CSS classes to the <body> tag to allow browser-specific CSS variation without resorting to CSS hacks. Since these are performed once at startup, CSS may be statically defined without the need to mix browser-specific logic into the presentation.
Multiple classes are created for each user-agent, allowing the web developer to target browser classes on differing levels of granularity. The general pattern is browser name followed by version number:
ua-browsername
ua-browsername-major
ua-browsername-major-minor
ua-browsername-major-minor-build
ua-browsername-major-minor-build-revision
Some browsers have multiple listings if the rendering engine is significant. For instance, Gecko-based browsers (such as Firefox, Mozilla, Netscape, Camino, SeaMonkey) also define Gecko CSS classes, to target all browsers of a specific Gecko version at once.
Below is an example of a number of browser labels which display differently under the presence of different CssUserAgent classes.
- Gecko
- Gecko 1.7
- Gecko 1.8
- Gecko 1.9
- Gecko 2
- Firefox
- Firefox 1.x
- Firefox 1.0
- Firefox 1.5
- Firefox 2.x
- Firefox 3.x
- Firefox 3.0.x
- Firefox 3.1
- SeaMonkey
- SeaMonkey 1.x
- SeaMonkey 1.1
- Netscape
- Netscape 5.x
- Netscape 6.x
- Netscape 7.x
- Netscape 7.2
- Netscape 8.x
- Netscape 9.x
- Safari
- Safari 1.x (85.x)
- Safari 2.x (419.x)
- Safari 2.0.4 (419.3)
- Safari (522.x)
- Safari 3.0 (523.x)
- Safari 3.1 (525.21)
- Safari 3.2 (525.27)
- Safari 4.0 (526.x)
- Safari 4.0dp1 (526.8)
- Apple Webkit
- Apple Webkit 419.x
- Apple Webkit Nightly 420.x
- Apple Webkit 522.x
- Apple Webkit 523.x
- Apple Webkit 525.x
- Apple Webkit 525.27.1
- Chrome
- Chrome 0.2.x
- Chrome 0.2.149.29
- Chrome 0.3.x
- Chrome 0.3.154.x
- Chrome 0.4.x
- Internet Explorer
- Internet Explorer 5.x
- Internet Explorer 5.0
- Internet Explorer 5.5
- Internet Explorer 6.x
- Internet Explorer 7.x
- Internet Explorer 8.x
- Internet Explorer 9.x
- Opera
- Opera 7.x
- Opera 8.x
- Opera 9.x
- Opera 9.52
- iCab
- iCab 2.x
- iCab 3.x
- iCab 4.x