Event Onbeforeprint
# onbeforeprint Event
[ Event Object](#)
## Example
Execute JavaScript when the page is about to print:
[Try it Β»](#)
* * *
## Definition and Usage
The onbeforeprint event occurs when a page is about to be printed (before the print dialog appears).
**Note:** The opposite event of onbeforeprint is (#).
* * *
## Browser Support
| Event | | | | | |
| --- | --- | --- | --- | --- | --- |
| onbeforeprint | Not supported | Yes | Yes | Not supported | Not supported |
* * *
## Syntax
In HTML:
(#)
In JavaScript:
_object_.onbeforeprint=function(){_myScript_};(#)
In JavaScript, using the addEventListener() method:
_object_.addEventListener("beforeprint", _myScript_);(#)
**Note:** Internet Explorer 8 and earlier IE versions do not support the [addEventListener()](#) method.
* * *
Technical Details
| Bubbles: | No |
| --- |
| Can be canceled: | No |
| Event type: | Event |
| Supported HTML tags: | |
* * Event Object](#)
YouTip