Non-background pictures can be judged using img's onerror, but as for background pictures, I just accidentally discovered a method that is feasible by visual inspection, but I am not sure whether it is always feasible.
var img=new Image();
img .src="image address";
if(img.width==0){//Indicates that the image loading failed}
else{//Successful}
This method It is generally feasible, but we have tested whether it is feasible when the image is very large or the loading speed is very slow.
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