afterprint
在相关联的文档已开始打印或打印预览已关闭之后,触发 afterprint事件。
基本信息
- Specification
- 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():
js
window.addEventListener('afterprint', (event) => {
console.log('After print');
});
使用 onafterprint 时间监听属性:
js
window.onafterprint = (event) => {
console.log('After print');
};
规范
| Specification |
|---|
| HTML Standard # event-afterprint |
| HTML Standard # handler-window-onafterprint |
浏览器兼容性
BCD tables only load in the browser