On 12/02/2010 4:23 AM, SamGoody wrote:
In FF3.6 Browser.Engine.version returns 19.
I assume this corresponds to gecko version 1.9[.2], and was the same
in Firefox 3.5 (Gecko 1.9.1).
Is that correct?
If so, how do I target 3.6 only? (I must provide gradients if the
browser does not handle the css).
Perhaps the simplest way to do this is to do it in the CSS itself: a
snippet like this should do the trick:
.someClass {
background: #444 url('gradient.png');
background-image: -moz-linear-gradient(top, #444, #888);
background-image: -webkit-gradient(/* whatever the webkit syntax is
-- it's too obtuse and convoluted to be easily recalled. :) */);
background-image: linear-gradient(top, #444, #888);
}
Yes, this has the disadvantage that modern browsers will download the
gradient image unnecessarily, but it will mean that
a) You're not having to deal with presentational stuff in your
JavaScript, but only in your CSS;
b) Modern browsers still get the pretty gradients that scale appropriately;
c) The impact of unnecessarily loading the image shouldn't be too big,
assuming the image is correctly structured; and
d) Users with JavaScript disabled will still see your fancy gradient
effects.
Personally, I would be tempted to ditch the gradients in non-supporting
browsers, if at all possible. Progressive enhancement *is* the mot du
jour, after all. :)
- Barry
www.barryvan.com.au