The beforeprint event is fired when the associated document is about to be printed or previewed for printing.
| Bubbles | No |
|---|---|
| Cancelable | No |
| Interface | Event |
| Event handler property | onbeforeprint |
Examples
Using addEventListener():
window.addEventListener('beforeprint', (event) => {
console.log('Before print');
});
Using the onbeforeprint event handler property:
window.onbeforeprint = (event) => {
console.log('Before print');
};
Specifications
| Specification | Status |
|---|---|
| HTML Living Standard | Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
beforeprint event | Chrome Full support 63 | Edge Full support 12 | Firefox Full support 6 | IE Full support Yes | Opera Full support 50 | Safari Full support 13 | WebView Android Full support 63 | Chrome Android Full support 63 | Firefox Android ? | Opera Android Full support 46 | Safari iOS Full support 13 | Samsung Internet Android Full support 8.0 |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
See also
- Related events:
afterprint
