直接使用XMLHttpRequest对象的例子

var mp4check_xhr = function (weburls, url, callback) {
        var url_mp4 = url.replace(".webm", ".mp4");
        var xhr = new XMLHttpRequest;
        xhr.open('head', url_mp4);
        xhr.onload = function () {
            var length = xhr.getResponseHeader('content-length');
            if(length > 100){
                var weburl = weburls[url];
                for(var id in weburl) {
                    weburl[id].recordFile = url_mp4;
                }
                delete weburls[url];
                if(Object.keys(weburls).length <= 0) {
                    callback();
                }
            }else{
                delete weburls[url];
                if(Object.keys(weburls).length <= 0) {
                    callback();
                }
            }
        };
        xhr.onerror = function () {
            delete weburls[url];
            if(Object.keys(weburls).length <= 0) {
                callback();
            }
        }
        xhr.send();
    };