このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

Window: beforeprint イベント

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2019年9月⁩.

beforeprint イベントは、関連する文書が印刷される直前や、印刷プレビューが開く直前に発生します。

バブリング いいえ
キャンセル 不可
インターフェイス Event
イベントハンドラープロパティ onbeforeprint

addEventListener() の使用例:

js
window.addEventListener("beforeprint", (event) => {
  console.log("Before print");
});

onbeforeprint イベントハンドラープロパティの使用例:

js
window.onbeforeprint = (event) => {
  console.log("Before print");
};

仕様書

Specification
HTML
# event-beforeprint
HTML
# handler-window-onbeforeprint

ブラウザーの互換性

関連情報