[OpenLayers-Dev] "Broken" images on 404 in IE w/ TileCache Layer

Roald de Wit roald.dewit at lisasoft.com
Fri Nov 13 20:47:13 EST 2009


Hi Matt,

Matt Underwood wrote:
> I wrote a layer that inherits Layer.TileCache to work with a slightly
> different service (in this case images hosted on amazon's s3).  The
> problem comes with IE which displays "broken" images on those that are
> purposely omitted (404 is returned).  I looked at Tile.Image and it
> seems to attempt to fail gracefully and replace the image from what I
> understand.  Is there anything extra I need to do to ensure it
> replaces the image on failure?  Any help or pointers would be greatly
> appreciated, I was hoping to not have to debug Tile.Image :(
>   
If I understand you correctly, you want any 'broken' images to not be 
visible. This probably works fine in FF but in IE you see a tile with a 
broken image in it. Is that correct?

If so, depending on the version of OL that you use you can do either the 
following:

OL <= 2.8:

    OpenLayers.Util.onImageLoadErrorColor = "transparent";


OL > 2.8 (current trunk for example):

     .olImageLoadError {
         background-color: transparent !important;
    }

(you only need the "!important" bit if your CSS gets declared before OL 
styles get loaded (theme/default/style.css))

Does this help or does something else go wrong?

Regards,

Roald




More information about the Dev mailing list