-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
59 lines (39 loc) · 1.19 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: "HTMLMediaElement: abort event"
short-title: abort
slug: Web/API/HTMLMediaElement/abort_event
page-type: web-api-event
browser-compat: api.HTMLMediaElement.abort_event
---
{{APIRef}}
The **`abort`** event is fired when the resource was not fully loaded, but not as the result of an error.
This event is not cancelable and does not bubble.
## Syntax
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
```js
addEventListener("abort", (event) => {});
onabort = (event) => {};
```
## Event type
A generic {{domxref("Event")}}.
## Examples
```js
const video = document.querySelector("video");
const videoSrc = "https://example.org/path/to/video.webm";
video.addEventListener("abort", () => {
console.log(`Abort loading: ${videoSrc}`);
});
const source = document.createElement("source");
source.setAttribute("src", videoSrc);
source.setAttribute("type", "video/webm");
video.appendChild(source);
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{domxref("HTMLAudioElement")}}
- {{domxref("HTMLVideoElement")}}
- {{HTMLElement("audio")}}
- {{HTMLElement("video")}}