[英]check if the page print has been printed and then close it
我想檢查該頁面是否已打印,然后將其關閉。 我搜索了很多,但沒有我試過的答案:
1- window.matchMedia('print') but it return always false.
2-window.onafterprint it doesn't work anymore.
3- 我無法創建新文檔並在其中插入我的頁面正文,因為我的頁面來自 Crystelreport 並且它確實有條形碼。
我的代碼很簡單:
var win = window.open(url, 'popup', 'toolbar = no, status = no, scrollbars = yes, resizable = yes');
win.onafterprint = function () {
win.close();
}
嘗試這個:
var win = window.open(url, 'popup', 'toolbar = no, status = no, scrollbars = yes, resizable = yes');
win.onafterprint = function (e) {
e.target.close();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.