google chrome中的Javascript window.print被卡住

google chrome中的Javascript window.print被卡住,javascript,printing,Javascript,Printing,我尝试使用window.open+window.print打印一些元素 问题:当我们使用浏览器“X”按钮关闭打印对话框时,窗口。打印继续运行。如果使用“打印/取消”关闭“打印”对话框,则没有问题。见截图 这是我的密码: printWindow = window.open('', '', 'height=' + screen.height + ', width=' + screen.width); printWindow.document.write('<html><he

我尝试使用
window.open+window.print
打印一些元素

问题:当我们使用浏览器“X”按钮关闭打印对话框时,
窗口。打印继续运行。如果使用“打印/取消”关闭“打印”对话框,则没有问题。见截图

这是我的密码:

  printWindow = window.open('', '', 'height=' + screen.height + ', width=' + screen.width);
  printWindow.document.write('<html><head><title>Report</title>');
  printWindow.document.write('</head><body >');
  printWindow.document.write(gridData);
  printWindow.document.write('</body></html>');
  printWindow.document.close();
  printWindow.focus();
  printWindow.print();

  $("#printDiv .addedElements").remove(); //THIS WILL NEVER BE EXECUTED
  printWindow.close(); //THIS WILL NEVER BE EXECUTED
printWindow=window.open(“”,’高度=’+screen.height+’,宽度=’+screen.width);
printWindow.document.write(“报告”);
printWindow.document.write(“”);
printWindow.document.write(gridData);
printWindow.document.write(“”);
printWindow.document.close();
printWindow.focus();
printWindow.print();
$(“#printDiv.addedElements”).remove()//这永远不会被执行
printWindow.close()//这永远不会被执行

这是Chrome中的一个错误,是一个很大的问题。@Malk感谢您提供的信息,但可能有一个解决方法。这可能在36版中修复: