I am trying to open a new
window and print
the contents.
var parentHeader= $("head").html();
var parentDivContent = $("#printer_data_1").html();
var newW= window.open("", "", "scrollbars=1,width=200,height=200");
newW.document.write('<html><head><title>Title</title>'+parentHeader+'</head>');
newW.document.write('<body><div>');
newW.document.write(parentDivContent );
newW.document.write('</div></body></html>');
newW.document.close();
newW.print();
newW.close();
When i try to run the above code
, it hangs in IE8
, when i comment the below line... it works.
newW.document.write('<html><head><title>Title</title>'+parentHeader+'</head>');
I want the entire content, styles to be loaded in the head section of new window.