I’m using this code to print a printable map. In Firefox, the element will print, but in Chrome, it is a blank page. Why is Chrome not liking the code?
<script type="text/javascript">
function PrintElem(elem)
{
Popup($(elem).html());
}
function Popup(data)
{
var mywindow = window.open('', 'printableArea', 'height=400,width=600');
mywindow.document.write('<html><head><title>my div</title>');
/*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
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>
<div class="parent" id="printableArea">
<div id="panzoom" class="panzoom"><img class="alignnone size-full wp-image-1435" src="http://wondervalley.com/wp-content/uploads/2015/07/wvr-directions.svg" alt="" /></div>
</div>
<p style="text-align: center;"><span id="print-map" style="cursor: pointer; text-decoration: underline; color: #0000ff;" onclick="PrintElem('#printableArea')">Print Map</span></p>