Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!

 

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.

Specification

Browser compatibility

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support 6.0 no (Yes) no no
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
? ? ? ? ? ?

See also

  • window.print
  • window.onafterprint
  • Printing
  • It's able to do equivalent things in Webkit-based browser with matchMedia('print')
  • var mediaQueryList = window.matchMedia('print');
    mediaQueryList.addListener(function(mql) {
        if (mql.matches) {
            console.log('onafterprint');
        };
    });
 

文件標籤與貢獻者

標籤: 
 最近更新: hbloomer,