Hello,
I wrote a code to show me an image from a URL. I also implement a alt image in the case the main URL is not available, alternative image be shown.
Problem is , if the main URL at the beginning of loading the page is not available, the alternative image would be shown but when the main URL get OK, it still shows the alt image!
Should I refresh my page regularly to solve this issue or any other idea?
Is there anyway to check if the URL is available regularly and when it is ready I refresh the page?
Are you using <ion-img>
? Or just <img>
?
Hello
I am using:
img src=“file address” alt="image not found " onerror=“this,src=‘New image address’” >
Try using <ion-img>
. It should do exactly what you want – show the page immediately and redraw it when the image has been loaded.
Thanks for the response.
I have tried it but it does not work.
I mean , from my understanding , ion-img> does not support Onerror function.
when I use ion-img>, it just shows the main URL , not the one I wrote in onerror!!
Do you have any sample how should I use alternative image in ion-img>?
I have tried it with ion-img, but it is still not working!!