Skip to Content
0
Jun 01, 2018 at 01:59 PM

Catch Print Dialog in Browser

75 Views Last edit Jun 08, 2018 at 01:06 PM 2 rev

I am trying to catch the Print Dialog popup via JavaScript in a .NET Web App. I can catch the print button click by adding an event listener like this:

document.getElementById("CrystalReportViewer1_toptoolbar_print").addEventListener("click", function () {
//run some code here
return false;
});

I am displaying a "please wait" message and making the webpage disabled in the "//run some code here" section. But, after the user clicks Print or Cancel, I need to hide the "please wait" and enable the webpage. I tried to catch the "afterprint" event, but no luck.

Anyway to do that in JavaScript?