- how can I check if an image exist via javascript.
- is it possible to load an image called
145_44.jpgand I only know the first 3 numbers145?
how can I check if an image exist via javascript. is it possible to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The html image element has onerror and onload events that will fire if loading the image fails or succeeds respectively.
With regards to loading an image without knowing the correct URI, the answer is no. Its up to the web server to decide what to serve in response to an HTTP request. If the request is for a resource it doesn’t know about its very unlikely to serve anything other than a 404 error.