Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML5 onbeforeprint Event Attribute

HTML5 onbeforeprint Event Attribute

HTML Event Attributes HTML Event Attributes

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 HTML Event Attributes