Generic Fallback Mechanism Based on Network or User Agent compliance

Bert Bos wrote:
--cut-
>     Fonts and image replacement -
>       - What if I want to use the image *only* if my special font cannot
>         be downloaded/is not installed on the user's system?
--cut-

I have quite many times started discussions about replacement
background-colours esp. good for alpha images, and I was planning to give
it another go with a much broader approach enabling the logic to be used
for other properties (and also is inspired by earlier proposals by
others), here it be :

Generic fallback mechanism
(Please discuss the idea and not the syntax itself, I am sure W3 would
find good ways to realise it.)
background: [transparent url(grayishsemitransparent.png) repeat]
            [gray url(grayishopaque.jpg) 50% 50% no-repeat]
            [gray];

*Any block containing a network resource is attempted to be loaded but
would be considered as not fulfilled, so the next block is tried, if it
also contains one, the next. etc while only trying to load one network
resource at a time, so an attempt to load the second resource would only
be after we make sure the first didn't go well.
*Reasons a block cannot be fulfilled can be because:
  *User Agent does not understand the syntax
  *UA does not support that file type
  *UA has not enough memory to hold the resource

The same philosophy can be applied with content replacement etc.
--
In the example, we use a semi-opaque image and a transparent background,
so we can use repeat just in case of an overflow to support the text in
the element. When it fails for any of the reasons stated above, we use an
opaque image with a gray background, and we center it in the element
without having to repeat it as the gray background can support the text on
it.

For this example, there will surely be critics who would say font color
has to be set together with background-color, but that's something authors
have to take care. E.g. in this example all blocks would yield a grayish
background-color, and I don't think turning the color from green to red
because a resource cannot be loaded would not be practiced anyway, bearing
in mind the feature would primarily be used by accessibility aware
authors. Proposing a larger system of complex required-all blocks of
different properties etc did not help thus far, so I say we keep it
simple.

Emrah Baskaya
www.hesido.com

Received on Tuesday, 25 April 2006 07:13:29 UTC