You don't need ajax, just create a video element and see if it can load the source
var video = document.createElement('video');
video.onload = function() {
alert('success, it exsist');
}
video.onerror = function() {
alert('error, couldn\'t load');
}
video.src = 'http://www.example.com/video.mp4';
, , , canplaythrough
video.oncanplaythrough = function() {
alert("This file can be played in the current browser");
};
, , ajax HEAD , ,
var http = new XMLHttpRequest();
http.open('HEAD', '/folder/video.mp4');
http.onreadystatechange = function() {
if (this.readyState == this.DONE) {
if (this.status != 404) {
}
}
};
http.send();