MDN’s new design is in Beta! A sneak peek:

window.onbeforeprint Redirect 1


The onbeforeprint property sets and returns the onbeforeprint event handler code for the current window.


window.onbeforeprint = event handling code


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 beforeprint event is raised before the print job dialog appears.


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

Document Tags and Contributors

 Last updated by: Sheppy,