X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML onafterprint Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Execute a JavaScript when a page has started printing, or if the print dialogue box has been closed:

<body onafterprint="myFunction()">

Try it yourself »

Definition and Usage

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.


Browser Support

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.


Differences Between HTML 4.01 and HTML5

The onafterprint attribute is new in HTML5.


Syntax

<element onafterprint="script">

Attribute Values

Value Description
script The script to be run on onafterprint

Technical Details

Supported HTML tags: <body>


Related Pages

HTML DOM reference: onafterprint event


HTML Event Attributes HTML Event Attributes

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook