I\'m trying to print a page using this code
This worked for me (as well as implementing Anand's observed IE 10+ requirements):
function Popup() {
var _window = window.open('');
_window.document.write(data);
// required for IE >= 10
_window.document.close();
_window.focus();
_window.document.body.onload = function() {
// continue to print
_window.print();
_window.close();
};
return true;
}
Instead of waiting for the window to load and attempting to print it prematurely, this just waits for the entire document.body
to load.