title: How to get image size from URL
body: <p>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. </p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  
  xhr.open('HEAD', 'http://www.2015autoblog.com/wp-content/uploads/2014/09/2015-Toyota-Land-Cruiser-Front.jpg', true);
  </code></pre>
  
  <p>debugger</p>
  
  <pre><code>alert(xhr.status);
  
  if ( xhr.status == 200 ) {
      alert('Size in bytes: ' + xhr.getResponseHeader('Content-Length'));
  } else {
      alert('ERROR');
  }
  </code></pre>