1

I'm trying to build a download progress bar ( I download the canvas content as png image [converted from base64] ) and I have a little problem : Is there a way to track the download of a : <a href="/images/myw3schoolsimage.jpg" download> ? The available events for <a> , from : https://www.w3schools.com/tags/tag_a.asp doesn't seem to help me.

I've tried to put the <a> tag inside a <div> tag and use the div's events like :

 <div load="alert('test1');" progress="alert('test2');" >
  <a href="/images/myw3schoolsimage.jpg" download>
   <img src="/images/myw3schoolsimage.jpg" alt="W3Schools" width="104" height="142">
  </a>
 </div>

( https://en.wikipedia.org/wiki/DOM_events )

But didn't work.

So, to sum it up, what I'm trying to achieve by this is tracking the download after a click on a <a href="/images/myw3schoolsimage.jpg" download> so I can build a progress bar for the download

Any ideas?

Kaiido
  • 123,334
  • 13
  • 219
  • 285
DIIMIIM
  • 557
  • 7
  • 28

1 Answers1

0

Those attributes you have on your div element aren't doing anything; if you look at the wiki page again, you'll notice that each of those events has (none) listed under the Attribute column. The solution isn't as easy as you might have in mind. It's possible this explanation could help accomplish what you're looking for though: ajax file download : progress event, for download

agarcini
  • 16
  • 3
  • There is no ajax involved here though... – Kaiido Jun 24 '19 at 23:32
  • Thank you for help but I don't understand the meaning of this : `oReq.open("get", "url", true);` . This is a request but I don't need a request ,what I need is to get the canvas content and download on the user's device as a image.. – DIIMIIM Jun 25 '19 at 05:21