js window.open then print()

后端 未结 7 1887
深忆病人
深忆病人 2020-11-29 08:14

print() doesn\'t work in IE after opening a new window. It works in Chrome. Here\'s a tester:





        
相关标签:
7条回答
  • 2020-11-29 08:56

    As most of browsers has been updated, So print and close do not any more as It worked before. So you should add onafterprint event listener in order to close print window.

        var printWindow = window.open('https://stackoverflow.com/');
        printWindow.print();
    
        //Close window once print is finished
        printWindow.onafterprint = function(){
           printWindow.close()
        };
    
    0 讨论(0)
提交回复
热议问题