Link to home
Start Free TrialLog in
Avatar of david_88
david_88

asked on

Check if link if image link

I have a url for product images given to me

If the image does not exist i want to display a default image but without following the image link i cant tell whether it exists, so can i do this in code

how do i detect that the image is not available in code?

thanks

dave
Avatar of Blomholm
Blomholm

Pretty sure you can't check if files exists with JavaScript.
You'd have to do it in php, asp, jsp or similar.
Avatar of david_88

ASKER

oh ok thats fine, im building in php do you have any example code

cheers
ASKER CERTIFIED SOLUTION
Avatar of sunithnair
sunithnair

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Kin Fat SZE
Kin Fat SZE
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you could find is image.src is wrong path or unreadable by onerror event.. you could fire a javascript function by it
Used the php option, but thanks both for your help