Web features explorer
  • Home
  • Release notes
  • About
  • Features
  • Newly available
  • Widely available
  • Limited availability
  • Discouraged
  • Opposed
  • Most wanted
  • All features
  • Missing only in
  • Chromium
  • Firefox
  • Safari
  • Implemented only in
  • Chromium
  • Firefox
  • Safari
  • Features in latest releases
  • Chrome 158
  • Chrome Android 158
  • Edge 157
  • Firefox 160
  • Firefox for Android 160
  • Safari 27.2
  • Safari on iOS 27.2

Print events

Widely Available (since 2022-03-19)

An alternative to @media print queries, the beforeprint and afterprint events allow you to change the page for printing and restore the page after printing.

Browser support (view on caniuse.com)

  • Chrome 63 Released on 2017-12-06
  • Chrome Android 63 Released on 2017-12-05
  • Edge 12 Released on 2015-07-29
  • Firefox 6 Released on 2011-08-16
  • Firefox for Android 6 Released on 2011-08-16
  • Safari 13 Released on 2019-09-19
  • Safari on iOS 13 Released on 2019-09-19

MDN documentation

  • Window: afterprint event
  • Window: beforeprint event

Specifications

  • HTML (#event-afterprint), from HTML Workstream (WHATWG).
  • HTML (#event-beforeprint), from HTML Workstream (WHATWG).

Web Platform Tests (WPT)

View the latest WPT test results for this feature

View as JSON | Edit this feature | Report an issue | Web-features entry: source, dist