我有一個角度js應用程序,對於打印功能,我使用window.open方法打開html頁面。window.print()在IE中不起作用11
public openNewWindow(html: string, title: string) {
var popupWin = window.open('', '_blank', 'scrollbars=no,menubar=no,toolbar=no,location=no,status=no,titlebar=no, height=500, weidth=900');
popupWin.window.focus();
popupWin.document.write(html);
popupWin.document.title = title;
};
我在打印的HTML頁面上有一個按鈕。我使用onclick事件來打印。
<button class="print-btn" onclick="window.print();" id="view_print"> Print</button>
此代碼完美的作品在Chrome中,而不是在IE瀏覽器11.如果我從邊緣到IE 10的打印更改默認似乎工作,並打開打印對話框窗口。它肯定比Chrome慢。
我已經嘗試添加仿真如下(對於IE 10和8等),但它仍然無法正常工作。
我在這裏丟失了什麼?我發現了很多文章,但我無法修復它。
什麼不行? – epascarello
應該出現在選擇打印機上的打印對話窗口不會出現。它在Chrome中表現良好。 –
如果你添加'type =「按鈕」'到按鈕,它是否有區別 – epascarello