WindowEventHandlers.onafterprint
The onafterprint
property of the WindowEventHandlers
mixin is the event handler for processing afterprint
events for the current window. These events are raised after the user prints, or if they abort the print dialog.
The beforeprint
and afterprint
events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed. In general, you should prefer the use of a @media print
CSS at-rule, but it may be necessary to use these events in some cases.
Syntax
window.addEventListener("afterprint", function(event) { ... }); window.onafterprint = function(event) { ... };
Specifications
Specification |
---|
HTML Standard (HTML) # handler-window-onafterprint |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
onafterprint |
63 |
12 |
6 |
≤6 |
50 |
13 |
63 |
63 |
? |
46 |
13 |
8.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint