WindowEventHandlers.onbeforeprint

Our volunteers haven't translated this article into 한국어 yet. Join us and help get the job done!
You can also read the article in English (US).

 

Summary

The property onbeforeprint sets and returns the onbeforeprint event handler code for the current window.

Syntax

window.onbeforeprint = event handling code

Notes

Some browsers (including Firefox 6 and later and Internet Explorer) send beforeprint and afterprint events to let content determine when printing may have occurred. You can use this to adjust the user interface presented during printing (such as by displaying or hiding user interface elements during the print process).

The event beforeprint is raised before the print job dialog appears.

For Webkit-based browsers, you can create an equivalent result with window.matchMedia('print').

var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener('change', function(mql) {
  if(mql.matches) {
    console.log('webkit equivalent of onbeforeprint');
  }
});

 

Specification

Specification Status Comment
HTML Living Standard
The definition of 'onbeforeprint' in that specification.
Living Standard  

Browser compatibility

No compatibility data found. Please contribute data for "html.events.beforeprint" (depth: 1) to the MDN compatibility data repository.

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Edge Internet Explorer Opera Safari
Basic support 63.0 6.0 (Yes) (Yes) No support No support
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) Edge IE Mobile Opera Mobile Safari Mobile
Basic support No support ? ? ? ? No support ?

See also

 

문서 태그 및 공헌자

태그: 
 최종 변경: jmanos,