Ciao ragazzi so che è una cosa detta e ridetta ma devo eseguire un controllo sull'esistenza di un'immagine in remoto dato un link...
ho una funzione così strutturata:
codice:
function file_exists(url) {

	// Fire up the AJAX function
	var req = (function() {
		if (typeof XMLHttpRequest == "function") {
			return new XMLHttpRequest();
		} else {
			XMLHttpRequest = function () {
				try {return new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e){};
				try {return new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch(e){};
				try {return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){};
				return false;
			};
		}
	}());
	req.open('HEAD', url, false);
	req.send(null);
	return (req.status >= 200 && req.status < 300);
}
mi esegue il controllo egregiamente però se il link è sbagliato non mi fa ritornare niente!!!
cioè se io metto ad esempio

www.miosito.com/image.jpg (immagine esistente)
ritorna vero

seio metto
www.miosito.com/im<<<age.jpg (immagine non esistente)
ritorna falso

ma se io metto
www.mio<<<<sito.com/image.jpg

non mi segnala niente!!

tralasciando il fatto che per fare l'esempio ho messo il carattere <<< è per far capire che se sbaglio l'url non mi restituisce niente! cosa devo fare per mandarmelo in errore?