HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML onafterprint Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Execute a JavaScript after a page is set to print, and the print dialogue box has appeared:

<body onafterprint="printmsg()">

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The onafterprint event attribute is only supported in Internet Explorer and Firefox.

Note: In IE, the onafterprint attribute occurs before the print dialogue box, instead of after.


Definition and Usage

The onafterprint attribute fires after the user has set the page to print, and the print dialogue box has appeared.

Tip: The onafterprint attribute is often used together with the onbeforeprint attribute.


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


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 BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE