Email conversation
From | Adrian Versteegen |
To | Me |
Subject | alternative image in opera7.23 using onerror |
Date | 4 June 04 03:39 |
Hi,
I would like to have an alternative image display if the primary one is
not available. In IE6 and netscape7.1 I can make this work with
<img src="desiredImage.gif" onerror="this.src='alternativeImage.gif'">
i.e. if desiredImage.gif does not exist the alternativeImage.gif displays
but in opera7.23 I get nothing.
Is this a known issue?
Is there a solution?
Thanks
Adrian Versteegen
From | Me |
To | Adrian Versteegen |
Subject | Re: alternative image in opera7.23 using onerror |
Date | 5 June 04 11:03 |
Adrian,
I just tried this:
<img src="doesNotExist.jpg" onerror="this.src='doesExist.jpg';">
in Opera 7.0, 7.23 and 7.5. It works in all of them (the image
doesExist.jpg is shown instead).
However, the following:
<img src="corruptedImageFile.jpg" onerror="this.src='okFile.jpg';">
does _not_ work in Opera 7.23 but does work in 7.5. I do not know of any
work-around, since Opera 7.23 does not view file corruption as an image
load error.
If it is not working for you and you are using the first example (ie. you
request an image file that does not exist at all), it suggests that maybe
your image settings in Opera are set not to load images or to only load
cached images (file - preferences - multimedia - Images=Show Images).
Hope you find this useful.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Adrian Versteegen |
To | Me |
Subject | Re: alternative image in opera7.23 using onerror |
Date | 7 June 04 01:11 |
Thanks Mark,
I _was_ trying the first example _with_ images set to load but it still
didn't work here. I _wasn't_ aware there was a newer version of
opera around but I have now installed this and the image loading works as
expected.
Thanks again
Adrian Versteegen