onafterprint Event
Example
Call a function when a page starts printing:
<body onafterprint="myFunction()">
Try it Yourself »
Description
The onafterprint
event occurs when a page starts printing.
The onafterprint
event occurs when after the print dialogue box is closed.
Note
The browser fires onafterprint
and
onbeforeprint
so that notes, explanations and comments can be added
to the printing process.
See Also:
Syntax
In JavaScript, using the addEventListener() method:
object.addEventListener("afterprint", myScript);
Try it Yourself »
Technical Details
Bubbles: | No |
---|---|
Cancelable: | No |
Event type: | Event |
HTML tags: | <body> |
DOM Version: | Level 3 Events |
Browser Support
onafterprint
is a DOM Level 3 (2004) feature.
It is fully supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |