I am trying below code to get the image size in KB/MB/GB (not width and height) from live URL. But it's not working.
var xhr = new XMLHttpRequest();
xhr.open('HEAD', 'http://www.2015autoblog.com/wp-content/uploads/2014/09/2015-Toyota-Land-Cruiser-Front.jpg', true);
debugger
alert(xhr.status);
if ( xhr.status == 200 ) {
alert('Size in bytes: ' + xhr.getResponseHeader('Content-Length'));
} else {
alert('ERROR');
}