<script type="text/javascript">
 function PopupPrint(data) 
 {
 var mywindow = window.open('', 'Shopping Cart', 'height=666,width=500');
 mywindow.document.write('<html><head><title>Shopping Cart</title>');
 /*optional stylesheet*/ 
 
 mywindow.document.write('<link href="catalog/view/javascript/bootstrap/css/bootstrap.css" rel="stylesheet" media="all" />');
 mywindow.document.write('<scr'+'ipt type="text/javascript" src="view/javascript/jquery/jquery-2.1.1.min.js"></scr'+'ipt>');
 mywindow.document.write('<scr'+'ipt type="text/javascript" src="view/javascript/bootstrap/js/bootstrap.min.js"></scr'+'ipt>');
 mywindow.document.write('<link href="catalog/view/javascript/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet" />');
 mywindow.document.write('<link type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet.css" rel="stylesheet" media="all" />');
 
 var divToPrint = document.getElementById('print');

 mywindow.document.write('</head><body>');
 mywindow.document.write(divToPrint.innerHTML);
 mywindow.document.write('<scr'+'ipt type="text/javascript">$(window).load(function() { window.print(); window.close(); });</scr'+'ipt>');
 mywindow.document.write('</body></html>');


 mywindow.document.close(); // necessary for IE >= 10
 mywindow.focus(); // necessary for IE >= 10


 // mywindow.print();
 // mywindow.close();
 return true;
 }
</script>

參考
https://codedump.io/share/ELaqPuiqbw1v/1/element-print-preview-is-blank-and-prints-blank-pages-in-google-chrome

Hits: 45