I want to check if the page has been printed and then close it. I searched a lot but there is no answer I tried:
1- window.matchMedia('print') but it return always false.
2-window.onafterprint it doesn't work anymore.
3- I can not create a new doc and insert body of my page in it because my page comes from Crystelreport and it does have a barcode.
My code is simple:
var win = window.open(url, 'popup', 'toolbar = no, status = no, scrollbars = yes, resizable = yes');
win.onafterprint = function () {
win.close();
}
Try this:
var win = window.open(url, 'popup', 'toolbar = no, status = no, scrollbars = yes, resizable = yes');
win.onafterprint = function (e) {
e.target.close();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.