Skip to content Skip to sidebar Skip to footer

Using Onafterprint In Chrome & Safari

I am aware that until recently onafterprint was only native to IE. Recently HTML5 has added it to its list of events. I have only been successful in using it in Firefox but canno

Solution 1:

After some experiments, I think I can safely say that onafterprint is not worth considering.

  • Firefox fires it even if the user clicked Cancel instead of OK in the print dialog
  • IE8 apparently fires it even before the print dialog appears
  • Chrome doesn't fire it at all

Instead, just do whatever you wanted to do directly after calling print(), i.e.

$(document).ready(function() {
$('.printMe').click(function() {
    window.print();
    printIt();
    returnfalse;
  });
});

functionprintIt()
{
$('#confirmPrint').show();
};

Post a Comment for "Using Onafterprint In Chrome & Safari"