Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1034248 of WindowEventHandlers.onafterprint

  • Revision slug: Web/API/WindowEventHandlers/onafterprint
  • Revision title: WindowEventHandlers.onafterprint
  • Revision id: 1034248
  • Created:
  • Creator: irvinfly
  • Is current revision? No
  • Comment add webkit equivalent code sample

Revision Content

{{ApiRef}}

The WindowEventHandlers.onafterprint property sets and returns the {{event("onafterprint")}} {{domxref("EventHandler")}} for the current window.

Syntax

window.onafterprint = 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 afterprint event is raised after the user prints or aborts a print dialog.

Specification

Not part of any specification.

Browser compatibility

{{CompatibilityTable}}

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

See also

  • {{domxref("window.print")}}
  • {{domxref("window.onbeforeprint")}}
  • Printing
  • It's able to do equivalent things in Webkit-based browser with matchMedia('print')
  • var mediaQueryList = window.matchMedia('print');
    mediaQueryList.addListener(function(mql) {
        if (!mql.matches) {
    		console.log('onafterprint equivalent');
    	};
    });
    

Revision Source

<div>{{ApiRef}}</div>

<p>The WindowEventHandlers.onafterprint property sets and returns the {{event("onafterprint")}} {{domxref("EventHandler")}} for the current window.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">
<em>window</em>.onafterprint = <em>event handling code</em>
</pre>

<h2 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>afterprint</code> event is raised after the user prints or aborts a print dialog.</p>

<h2 id="Specification">Specification</h2>

<p>Not part of any specification.</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>6.0</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</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">See also</h2>

<ul>
 <li>{{domxref("window.print")}}</li>
 <li>{{domxref("window.onbeforeprint")}}</li>
 <li><a href="/en-US/docs/Printing" title="Printing">Printing</a></li>
 <li>It's able to do equivalent things in Webkit-based browser with <code>matchMedia('print')</code></li>
 <li>
  <pre>
<code>var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
    if (!mql.matches) {
<span class="Apple-tab-span" style="white-space:pre">		</span>console.log('onafterprint equivalent');
<span class="Apple-tab-span" style="white-space:pre">	</span>};
});</code>
</pre>
 </li>
</ul>
Revert to this revision