Utilizando image.completo para descobrir se a imagem está armazenada em cache no chrome?
Estive tentando descobrir se uma imagem externa está armazenada em cache no navegador com js, este é o código que tenho até agora:
<html>
<head></head>
<body>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script>
function cached( url ) {
$("#imgx").attr({"src":url});
if(document.getElementById("imgx").complete) {
return true;
} else {
if( document.getElementById("imgx").width > 0 ) return true;
}
return false;
}
</script>
<img id="imgx" src="" />
<script>
$(document).ready(function(){
alert(cached("http://www.google.com/images/srpr/nav_logo80.png"));
});
</script>
</body>
</html>
Funciona perfeitamente no Firefox, mas sempre retorna falso no Chrom
lguém tem alguma idéia de como fazê-lo funcionar com o chrom