Reputation: 1332
Apologies for the slightly vague question but I'm pulling my hair out. Since this update we have had numerous calls regarding printing from our web app. Our web app uses an iframe and we use css @media print to hide all but this iframe for printing purposes. Since the update the user receives an Error 404--Not Found instead of the actual page. It would seem from the network trace that IE creates a temp .htm file in the local directory like D3CD911.htm, it then downloads css/js resources and then finally it makes this call /D3CD911.htm. This is making a call to www.mywebsite.co.uk/D3CD911.htm. This obviously does not exist on the website so the 404 is returned. I struggling to find a pattern to the problem and it doesn't seem to be affecting other public sites. I think the issue is with window.print() method. I can semi reproduce it here at https://www.primefaces.org/showcase/ui/misc/printer.xhtml. If you click the print button you will get the error. Although this is using the jqprint javascript function if you then use the browser print button it also fails.
Any guidance would be much appreciated.
Upvotes: 21
Views: 27354
Reputation: 371
andyfinch, you're a genius! The following code appears to work for a print button contained within a frame:
function Print() {
if (document.queryCommandSupported('print')) {
document.execCommand('print', false, null);
}
else {
window.parent.<framename>.focus();
window.print();
}
}
Upvotes: 13
Reputation: 1006
MS released updates yesterday (June 27th) that address it for Windows 10:
This non-security update includes quality improvements. No new operating system features are being introduced in this update. Key changes include:
• Addressed an issue introduced by KB4022715 where Internet Explorer and Microsoft Edge printing from a frame may result in 404 not found or blank page printed.
Links:
Windows 10 (Initial Release - Build 10240)
Windows 10 Version 1511 (Initial Release - Build 10586)
Windows 10 Version 1607 (Initial Release - Build 14393)
Windows 10 Version 1703 (Initial Release - Build 15063)
I grabbed them from the Windows Update Catalog today, to use with WSUS.
Upvotes: 2
Reputation: 1332
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.
Upvotes: 9
Reputation: 1134
We were having multiple frames in the print screen and calling document.execCommand('print', false, null);
could not fix our issue. Instead window.parent[frameName].document.execCommand('print', false, null);
fixed it.
Upvotes: 0
Reputation: 758
Heres the workaround I have been using for this in IE 11:
Upvotes: 1
Reputation: 73
andyfinch's workaround is also working for us. Thanks Andy!
MS has flagged this issue with "WON'T FIX" (6/15/17): https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12349663/ Update: that flag might just indicate that it's not an issue with MS Edge so it won't get fixed by the Edge developers.
Installing KB4021558 breaks printing from our website (the pages are blank, the footer shows some variant of "res://ieframe.dll/i273gyew.htm"). Uninstalling it restores printing functionality.
KB4021558 is also included in KB4022719, KB4022725 and KB4022727.
Upvotes: 7
Reputation: 66
I found a workaround: if the iframe you're trying to print is visible, right click on it and choose Print preview... instead of Print... from the context menu. The preview seems to be printable (but may show only part of the frame contents).
Also, for the record, the problematic 64-bit Win7 update is KB4022719.
Upvotes: 2