Our website has a feature whereby a member profile can be printed. The way that it works is that a javascript function is attached to a button via an onsubmit. The javascrip
The Chrome is so fast that it actually call the print before the document is loaded. That's why the best thing to do is just moving the print function to onload, either like Mari or like this:
winPrint = window.open("", "winPrint", "width=1,height=1");
winPrint.document.write(html);
winPrint.onload = function () {
window.print();
window.close();
};
And o.c. it's not working in IE so full code should look like this
var is_chrome = Boolean(window.chrome);
if (is_chrome) {
winPrint.onload = function () {
window.print();
window.close();
};
}
else {
winPrint.print();
winPrint.close();
}