Adrian Versteegen

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromAdrian Versteegen
ToMe
Subjectalternative image in opera7.23 using onerror
Date4 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
FromMe
ToAdrian Versteegen
SubjectRe: alternative image in opera7.23 using onerror
Date5 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/
FromAdrian Versteegen
ToMe
SubjectRe: alternative image in opera7.23 using onerror
Date7 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
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.