Window.onbeforeprint

  • Revision slug: Web/API/window.onbeforeprint
  • Revision title: window.onbeforeprint
  • Revision id: 412389
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment

Revision Content

{{DomRef}}

Summary

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

Syntax

window.onbeforeprint = event handling code

Notes

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.

Specification

HTML5 Working Draft.

Browser compatibility

{{CompatibilityTable}}
Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support 6.0 no {{CompatVersionUnknown}} no no
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
{{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

See also

  • {{domxref("window.print")}}
  • {{domxref("window.onafterprint")}}
  • Printing

Revision Source

<div>
  {{DomRef}}</div>
<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code>onbeforeprint</code> property sets and returns the <code>onbeforeprint</code> event handler code for the current window.</p>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="syntaxbox">
window.onbeforeprint = <em>event handling code</em>
</pre>
<h2 class="Notes" id="Notes">Notes</h2>
<p>Some browsers (including Firefox 6 and later and Internet Explorer) send <code>beforeprint</code> and <code>afterprint</code> 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).</p>
<p>The <code>beforeprint</code> event is raised before the print job dialog appears.</p>
<h2 id="Specification" name="Specification">Specification</h2>
<p><a href="http://www.w3.org/TR/html5/webappapis.html#handler-window-onbeforeprint">HTML5 Working Draft</a>.</p>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Firefox (Gecko)</th>
        <th>Chrome</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>6.0</td>
        <td>no</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>no</td>
        <td>no</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>Android</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li>{{domxref("window.print")}}</li>
  <li>{{domxref("window.onafterprint")}}</li>
  <li><a href="/en-US/docs/Printing">Printing</a></li>
</ul>
Revert to this revision