Javascript 删除internet explorer上的页码、标题和url-window.print()
我想在我的Angular应用程序中打印一页。在Internet Explorer上,页码、url和标题始终可见 我已经试过了Javascript 删除internet explorer上的页码、标题和url-window.print(),javascript,html,css,printing,Javascript,Html,Css,Printing,我想在我的Angular应用程序中打印一页。在Internet Explorer上,页码、url和标题始终可见 我已经试过了 @page { size: auto !important; margin: 0mm !important; } 在css文件中。但在IE中似乎没有效果 还有其他建议吗?您可以使用此javascript代码。注意:您需要自定义打印按钮 document.getElementById("printButton").addEventListener('click
@page {
size: auto !important;
margin: 0mm !important;
}
在css文件中。但在IE中似乎没有效果
还有其他建议吗?您可以使用此javascript代码。注意:您需要自定义打印按钮
document.getElementById("printButton").addEventListener('click',printPage);
function printPage(){
var curURL = window.location.href;
history.replaceState(history.state, '', '/');
window.print();
history.replaceState(history.state, '', curURL);
}
这只能通过浏览器设置完成: 单击浏览器右侧的“设置”图标。将鼠标悬停在“打印”上,然后在子菜单中选择“页面设置” 您可以在其中更改页眉和页脚 页码和标题在页眉中,url和日期在页脚中-只需将下拉列表设置为
-空-
可能没有办法做到这一点。