html - Esablishing if file exists on another domain using javascript -
i wish test javascript within html page if following files exist or not:
http://www.focloir.ie/media/ei/sounds/ag_c.mp3 // exists http://www.focloir.ie/media/ei/sounds/og_c.mp3 // doesn't exist my html page not on same domain files above.
is possible?
i wish solve using single html file (no db or php etc.) since project simple prototype.
this looks promising, although super slow , ugly :)
var _word = "ag"; var _audio = audio(); function update_src(audio, word) { if (audio.canplaytype('audio/mpeg;')) { audio.src = "http://www.focloir.ie/media/ei/sounds/" + word + "_c.mp3"; } else { audio.src = "http://www.focloir.ie/media/ei/sounds_ogg/" + word + "_c.ogg"; } } update_src(_audio, _word); _audio.load(); _audio.addeventlistener("durationchange", function () { alert("exits"); });
Comments
Post a Comment