I am using PrintArea and I want to handle 'Close' event of Print dialog box(Chrome, Firefox,...). I have tried
window.onclose = function(){
// do something
}
but it did not work.
Is there any way to do it?
Any solution is appreciated.
I am using PrintArea and I want to handle 'Close' event of Print dialog box(Chrome, Firefox,...). I have tried
window.onclose = function(){
// do something
}
but it did not work.
Is there any way to do it?
Any solution is appreciated.
window.print() //or whatever you want to do
window.onfocus=function(){
//user is back
}
Do this
window.print() //open the print dialog box
window.onafterprint=function(){
//do whatever it is you wish to do
}
Note
This only works for Firefox (>6.0) and Internet Explorer.
For other browsers including Chrome, try window.matchMedia()
window.print() //open the print dialog box
var printEvent = window.matchMedia('print');
printEvent.addListener(function(printEnd) {
if (!printEnd.matches) {
// do whatever you wish to do
};
});