I'm trying to open a new window with javascript and fill it with the html from the current window. Sort of like a print preview in a new window and with a new css.
function prnt() {
var pr = window.open("", "", "width=1020,height=750");
pr.document.open();
pr.document.write('<html><head><title>Test</title>');
pr.document.write('<link href=print.css rel=Stylesheet></head><body>');
pr.document.write(document.body.innerHTML);
pr.document.write('</body></html>');
pr.document.close();
pr.focus();}
I'm calling this function from here:
<a id="print" href="#" runat="server" onclick="javascript:prnt();">PRINT</a>
IE gives me the error the remote procedure call failed and it seems to be pointing to this line:
pr.document.close();
Everything works fine in FF though. Any ideas?
EDIT
I'm running on a Windows Server 2008 R2 Standard
SP1
EDIT2
If I remove pr.document.close(); the page works perfect in IE and done is displayed in the status bar.
However, now FF won't work properly. The page never actually stops loading. I guess it's waiting for the pr.document.close(); command?