title: How to download image object on page as a file in html?
body: <p>I am creating an image dynamically on the page using dataURL,</p>
  
  <pre><code>    var aImg = document.createElement('img');
      aImg.setAttribute('src', dataURL);
      aImg.setAttribute('alt', 'pic');
      aImg.setAttribute('width', '438px');
      aImg.setAttribute('height', '267px');
      aImg.onclick = (function() {
           //download the image object
      })();
  </code></pre>
  
  <p>I am not sure what to do to download this image object that is a PNG image.
  Can someone give hints?</p>