W3cubDocs

/DOM

WindowEventHandlers.onafterprint

The WindowEventHandlers.onafterprint property sets and returns the afterprint EventHandler for the current window.

Syntax

window.onafterprint = event handling code

Notes

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 content authors should prefer the use of an @media print CSS at-rule, but it may be necessary to use these events in some cases.

The afterprint event is raised after the user prints, or if they abort the print dialog.

Safari does not implement these events.

Specification

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 63 Yes 6 Yes 50 No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 63 63 Yes ? 50 ? ?

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onafterprint