onafterprint Event
Example
Execute a JavaScript when a page has started printing:
<body onafterprint="myFunction()">
Try it Yourself »
Definition and Usage
The onafterprint event occurs when a page has started printing, or if the print dialogue box has been closed.
Tip: The onafterprint event is the opposite of the onbeforeprint event.
Browser Support
Event | |||||
---|---|---|---|---|---|
onafterprint | 63 | Yes | Yes | Not supported | Not supported |
Syntax
In JavaScript, using the addEventListener() method:
object.addEventListener("afterprint", myScript);
Try it Yourself »
Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.
Technical Details
Bubbles: | No |
---|---|
Cancelable: | No |
Event type: | Event |
Supported HTML tags: | <body> |
DOM Version: | Level 3 Events |