Suganya
Suganya

Reputation: 11

window.print not working in IE9

The JavaScript function window.print is working in IE7 and 8, but not in IE9. Can someone help to fix this?

Upvotes: 1

Views: 3710

Answers (3)

Paul
Paul

Reputation: 11

Try following code:

onClick="javascript:window.print();
return false;

Upvotes: 1

kanchup2
kanchup2

Reputation: 1

you need to do few things.

  1. Add a in the

  2. close the document properly: mywindow.document.close();

  3. do focus on the documnet: mywindow.focus();

  4. then write the print code: mywindow.print();

exp:

var mywindow = window.open('', 'My Print Data', 'width=850,scrollbars=yes');
mywindow.document.write('<html><head><title>Print Page</title><meta http-    equiv="X-UA-Compatible" content="IE8"/>');
..........
.........
.........
...........
mywindow.document.write('</div></body></html>');
mywindow.document.close();
mywindow.focus();
mywindow.print();

Upvotes: 0

Mackelito
Mackelito

Reputation: 4421

Try this:

onclick="window.print(delay*1000); return false;"

Upvotes: 0

Related Questions