afterprint

在相关联的文档已开始打印或打印预览已关闭之后, 触发 afterprint事件。

基本信息

Specification
HTML5
Interface
Event
Bubbles
No
Cancelable
No
Target
DefaultView (<window>)
Default Action
None

属性

Property Type Description
target 只读 EventTarget The event target (the topmost target in the DOM tree).
type 只读 DOMString The type of event.
bubbles 只读 Boolean Whether the event normally bubbles or not.
cancelable 只读 Boolean Whether the event is cancellable or not.

例子

使用 addEventListener():

window.addEventListener('afterprint', (event) => {
  console.log('After print');
});

使用 onafterprint 时间监听属性:

window.onafterprint = (event) => {
  console.log('After print');
};

规范

Specification Status
HTML Living Standard Living Standard

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
afterprint eventChrome Full support 63Edge Full support 12Firefox Full support 6IE Full support YesOpera Full support 50Safari Full support 13WebView Android Full support 63Chrome Android Full support 63Firefox Android ? Opera Android Full support 46Safari iOS Full support 13Samsung Internet Android Full support 8.0

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

相关事件