Created
September 27, 2013 10:26
-
-
Save gerbenvandijk/6726644 to your computer and use it in GitHub Desktop.
Check for a valid image in HREF.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function IsValidImageUrl(url, callback) { | |
jQuery("<img>", { | |
src: url, | |
error: function() { callback(false); }, | |
load: function() { callback(true); } | |
}); | |
} | |
// usage | |
IsValidImageUrl(url, function(result) { | |
//action | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment