Latest web development tutorials
 

onafterprint Event

< Event Object

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 Not supported Yes Yes Not supported Not supported

Syntax

In HTML:

<element onafterprint="myScript">
Try it Yourself »

In JavaScript:

object.onafterprint=function(){myScript};
Try it Yourself »

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

< Event Object