Browser Information

HeadJS knows certain information about the browser and exposes that information via CSS & JS

These variables are accessible via JavaScript (all the time) so you can apply certain logic depending on specific use-cases

{% highlight js %} if (head.browser.ie && head.browser.version < 9) { /* code specific to IE but only if IE < 9 */ } {% endhighlight %}

The same information is also exposed via CSS, so that you may apply CSS specific fixes

{% highlight css %} .ie8 { /* code specific to IE8 */ } .ie-lt9 { /* code specific to IE but only if IE < 9 */ } {% endhighlight %}

No matter how HeadJS is configured, it will at least generate CSS classes for the current browser & it's version (.ie8, .ff25). Generating classes for (.lt, .gt) including full min/max ranges of browser versions is supported, but not advised since it can generate too much css. By default only current browser + version, and IE6-11 ranges are generated automagically.

You can select which variables are exposed via CSS in the configuration section.

Show Comments