HTML5 onbeforeprint Event Attribute
Example
Set up the page for printing, but execute JavaScript before the print dialog appears:
Try it »
Browser support
| Events | |||||
|---|---|---|---|---|---|
| onbeforeprint | 63 | Yes | Yes | 13 | 50 |
Definition and Usage
The onbeforeprint attribute is triggered when the user sets up the page for printing, but before the print dialog appears.
Tip: The onbeforeprint attribute is usually used with onafterprint property.
Differences between HTML 4.01 and HTML5
The onbeforeprint attribute is new in HTML5.
Syntax
<
element
onbeforeprint="
script
">
HTML Event Attributes