Window.Print() Not Working in Ie

Window.print doesn't work in IE

You MUST do a mywindow.document.close() and you may NOT have a space in the window name

I assume you invoke PrintElem from onclick of something - if that something is a link, you need to return false in the onclick handler!

Here is how I would do it if I had to

function PrintElem(elem) { 
Popup($(elem).html());
}

function Popup(data)
{
var mywindow = window.open('', 'to_print', 'height=600,width=800');
var html = '<html><head><title></title>'+
'<link rel="stylesheet" href="css/mycss.css" type="text/css" />'+
'</head><body onload="window.focus(); window.print(); window.close()">'+
data+
'</body></html>';
mywindow.document.write(html);
mywindow.document.close();
return true;
}

but I am not sure whether or not the window.close() will interfere with the printing

And why not

$(function() {
$('#print_it').click(function(){
popup($('#itinerario').html());
});
});

IE11 Windows 7 Print issue after kb4021558

Update:
Microsoft have now released a patch: Microsoft IE patch

Just wanted to summarise the workarounds I've found and which have been posted here.

1) If you are using your own print button change to use document.execCommand('print', false, null);. Test support using document.queryCommandSupported('print') and call window.print() if not supported (Prob just Firefox)

2) Use Print Preview. Additionally select the part of the page to print, right click and select print preview. Then select As selected on screen.

3) Use another browser like Chrome

4) Uninstall the update

5) Wait for Microsoft fix. Their KB page KB Link has been updated with this as a known issue. Therefore you assume a fix is on the way.



Related Topics



Leave a reply



Submit