Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Verificando se a imagem existe ...
- * @param {[type]} imageUrl [description]
- * @param {[type]} callBack [description]
- */
- function checkImageExists(imageUrl, callBack)
- {
- var imageData = new Image();
- imageData.onload = function() {
- callBack(true);
- };
- imageData.onerror = function() {
- callBack(false);
- };
- imageData.src = imageUrl;
- }
- let foto = "https://palhocasites.com.br/webview/images/fornecedores/capita-marvel.jpg"
- checkImageExists(foto, function(existsImage)
- {
- if(existsImage == true) {
- console.log('imagem')
- } else {
- console.log('sem imagem')
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement