I use image file from other site.
<img src="//othersite.url/xxx.jpg">
But it's often unvisible. Because Http status is 404 ,301, etc.
How can I check the image can be visible?
I use image file from other site.
<img src="//othersite.url/xxx.jpg">
But it's often unvisible. Because Http status is 404 ,301, etc.
How can I check the image can be visible?
In php you can check it if file exist ..
<?php
$imageurl=//othersite.url/xxx.jpg;
if(file_exists($imageurl)
echo "Yes";
else
echo "No";
?>
Use onload
and onerror
event handlers.
<img src="//othersite.url/xxx.jpg" onerror="alert('error')" onload="alert('image loaded')" >