Use the onerror event of the image object to judge. If an error occurs, replace the src of the image object with the URL of the default image.
The following is the judgment through js
Use javascript to judge whether the specified image file exists:
For example, judge
this picture Whether the address exists.
If it does not exist, re-detect the image every few seconds. If the address is valid, it will prompt that the address is valid
The above returns true if the image exists
If the image exists, return GIF89aX
Because the picture does not exist, return that the picture does not exist!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn