Reputation: 3226
how do i print a html page which is getting opened in a popup ?
what I tried is :
function printFile() {
var w = window.open('test.htm', 'name', 'width=200,height=200');
w.focus();
w.print();
}
but the above code always prints about:blank.
Upvotes: 2
Views: 4925
Reputation: 3734
You have to wait for the window to load:
function printFile() {
var w = window.open('test.htm', 'name', 'width=200,height=200');
w.onload = w.print;
w.focus();
}
Upvotes: 2
Reputation: 8981
check your test.htm page it should be in same folder
i have check your code it's run perfectly.
Upvotes: 0