Web/API/Window/beforeprint event

From Get docs


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

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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