I need to get the file size of large videos, so I wrote this function :
function GetFileSize(Url){
var size;
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function () {
if (this.readyState == this.DONE) {
size=ajax.getAllResponseHeaders();
size=parseInt(ajax.getResponseHeader("Content-Length"));
}
};
ajax.open('HEAD', Url, false); // <-- the 'false' makes it synchronous, and the 'HEAD' avoid to download the whole file
ajax.send(null);
return size/1048576;
}
which doesn't work, and it appear you don't supportHEADrequests :
I need to get the file size of large videos, so I wrote this function :
which doesn't work, and it appear you don't support
HEAD
requests :The real site work as expected when it receive the request, but the brother reject the content (because of SOP):