Execute a JavaScript when a page has started printing, or if the print dialogue box has been closed:
The onafterprint attribute fires when a page has started printing, or if the print dialogue box has been closed.
Tip: The onafterprint attribute is often used together with the onbeforeprint attribute.
Event Attribute | |||||
---|---|---|---|---|---|
onafterprint | Not supported | Yes | Yes | Not supported | Not supported |
Note: In IE, the onafterprint attribute occurs before the print dialogue box, instead of after.
The onafterprint attribute is new in HTML5.
Value | Description |
---|---|
script | The script to be run on onafterprint |
Supported HTML tags: | <body> |
---|
HTML DOM reference: onafterprint event