我使用以下功能在Internet Explorer 11中打印我的弹出窗口:
function openWin() {
var myWindow = window.open('', '', 'width=200,height=100');
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.focus();
window.print();
}
但是,window.print()
仅在兼容模式下打开Internet Explorer时有效。那么如何设置window.open以兼容模式打开新窗口?
编辑:建议的重复问题中的答案对我没有用,我收到了这个错误:
"You can only have one <title> element within the <head> element."
显示元标记兼容模式的建议答案并未显示如何在window.open中使用它。