title: Window.onbeforeprint and Window.onafterprint get fired at the same time
body: <p>I have defined <code>onbeforeprint</code> and I modify my html code and now once I finish printing that is on select of print button I want the <code>onafterprint</code> to be fired but it does not.</p>
  <p>Instead when I press the <kbd>Control</kbd> + <kbd>Print</kbd> button the <code>onbeforeprint</code> is fired first and then the <code>onafterprint</code> event and then print dialog is shown.</p>
  <p>Is there any way I could in some way do changes to my html after the <kbd>Print</kbd> button is clicked?</p>
  <p>Am using IE -9 browser and the code is as follows:</p>
  <p><strong>Code</strong></p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
      window.onbeforeprint = function () {
          alert('Hello');
      }
      window.onafterprint = function () {
          alert('Bye');
      }
  &lt;/script&gt;
  </code></pre>