blob: fbf8c38b2ac06ae97ff42a76e9958a6afca9797b (
plain)
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
|
---
title: beforeprint
slug: Web/API/Window/beforeprint_event
tags:
- Evènement
- Reference
translation_of: Web/API/Window/beforeprint_event
original_slug: Web/Events/beforeprint
---
L'événement **`beforeprint`** est déclenché lorsque le document associé est sur le point d'être imprimé ou qu'un "aperçu avant impression" est lancé.
## Informations générales
- Spécification
- : [HTML5](https://html.spec.whatwg.org/multipage/webappapis.html#printing)
- Interface
- : Event
- Propagation
- : Non
- Annulable
- : Non
- Cible
- : DefaultView (`<window>`)
- Action par défaut
- : Aucune
## Exemples
En utilisant `window.addEventListener()` :
window.addEventListener("beforeprint", (evenement) => {
console.log("Before print");
});
## Propriétés
| Property | Type | Description |
| ------------------------------------- | ------------------------------------ | ------------------------------------------------------ |
| `target` {{readonlyInline}} | {{domxref("EventTarget")}} | The event target (the topmost target in the DOM tree). |
| `type` {{readonlyInline}} | {{domxref("DOMString")}} | The type of event. |
| `bubbles` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event normally bubbles or not. |
| `cancelable` {{readonlyInline}} | {{jsxref("Boolean")}} | Whether the event is cancellable or not. |
## Evénements liés
- [afterprint](/en-US/docs/Mozilla_event_reference/afterprint)
|