Wait For Html To Write To Window Before Calling Window.print()
I have this javascript code attached that puts some content into a popup window and then tries to print it: $('.print_friendly_popup').click(function() { var target = $(this).d
Solution 1:
So how about this: create some sort of "checker" to see if the window has the content in it, for example:
var checkForContent = function () {
setTimeout(function () {
var content = win.document.querySelector('body').innerHTMLif (content.length) {
win.print()
win.close()
} else {
checkForContent()
}
}, 200)
}
This way you're politely waiting for the content to render before printing.
Post a Comment for "Wait For Html To Write To Window Before Calling Window.print()"