HTML onafterprint event attribute
Instance
After printing on the settings page and the print dialog has appeared, execute a JavaScript segment:
<body> onafterprint="printmsg()">
Browser Support
IE | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
Only Internet Explorer and Firefox support the onafterprint event attribute.
Note:In IE, the onafterprint attribute occurs before the print dialog appears, not after.
Definition and Usage
The onafterprint attribute occurs after the user sets the page to print and the print dialog has appeared.
Tip:The onafterprint attribute is often used with the onbeforeprint attribute.
Differences between HTML 4.01 and HTML5
The onafterprint attribute is a new attribute in HTML5.
Syntax
<element onafterprint="script">
Attribute Value
Value | Description |
---|---|
script | Script executed when onafterprint occurs. |