I have a headache about the event "abort" or "onabort" for what it serves?

Asked

Viewed 64 times

2

I’ve reviewed the entire web I’ve searched for help on Google on Youtube I’ve already left my doubt on other question sites more I never find a concrete example about what it’s for and always say the same thing they are for when the video is aborted What else can I take the example? An easy answer to understand? Whoever can help me is grateful.

1 answer

4

Abort is the event that occurs when a resource (here can be understood as an image, video or audio resource) has been interrupted:

Abort Event

To address this event, the Handler used is the onload, so as Handler for the click event is onclick, and so on:

onabort Event Handler

Therefore, to treat when abortion occurs in an element, using the onabort, that will notify this.

Examples:

<video onabort="abortouVideo()">
<img src="" onabort="abortouImagem()">

...

function abortouVideo() { console.log("erro ao carregar video"); }
function abortouImagem() { console.log("erro ao carregar imagem"); }
  • In the case of this code how could I interrupt the video or image so it can perform the message on the console?

  • but that would already be the subject of another question, until interesting.... but in a simple way you can’t "programmatically" talking do it.... what you can do is maybe change the "src" of the video during loading, this may interrupt the load, but you need to test to confirm

Browser other questions tagged

You are not signed in. Login or sign up in order to post.