0 pts.
 JavaScript window.print() does nothing
I have a web page with JavaScript that: Uses var win = window.open('', '_blank', ''); to create a new window Uses win.document.write(htmlString); to build the new window's HTML. It contains a button with an "onClick" attribute of "window.print();". When the new window's print button is clicked with IE6 (I haven't tested with other browsers), nothing happens - no error, but no Windows print dialog either. I've added alerts to the "onClick" Javascript before and after the window.print statement to make sure that event is being triggered.

Software/Hardware used:
ASKED: May 19, 2004  9:52 AM
UPDATED: May 20, 2004  10:06 AM

Answer Wiki:
I've noticed after modifying ESS screens to open a new window or having a print window pop up that it always failed for certain users. Turned out they had "Pop-up" blockers installed on their browsers which caused it to fail. Just a thought.
Last Wiki Answer Submitted:  May 19, 2004  9:56 am  by  JonathanK   0 pts.
All Answer Wiki Contributors:  JonathanK   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I saw something about having to call the documents close method newWindow.document.close();

 0 pts.

 

I added window.document.close(), and it works now.

Thanks, tmjimob!

 0 pts.

 

Great! Lucky guess – I didn’t really think it would work, but glad it did :)

 0 pts.