I’m printing a webpage using the javascript
window.print();
whether enclosed in a document.ready or onload event inline the print dialog often pops up before the content is ready.
Ive tried this
$(document).ready(function() {
setTimeout(printPage(),200000);
function printPage()
{
window.print();
}
});
To no avail, can anyone suggest a way to reliably defer printing until the content is ready
You are passing the return value of
printPagetosetTimeout. You have to omit the parenthesis:I hope you know that 200000ms are more than 3 minutes
printPage()will call the function.Or if you want to call when everything is loaded, call the function in the
loadevent handler: