window.print() is not working in Microsoft Edge browser

Fixed Issue #17148061

Details

Created
Apr 23, 2018
Privacy
This issue is public.
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

We are calling window.print() from the javascript to open operating system printer dialog box. Most of the times, printer dialog box is not opening. It works well in Internet Explorer, Issue is only with Microsoft Edge browser.

When we look into the console logs using Developer Tools(F12). we got the below exception,
SCRIPT65535: Unexpected call to method or property access.
preview.js (358,1)
Line No 358 in preview.js --> Printer.startPrint();

Note : when we click print in our web page, new tab will open and in that page onload function from javascript is called, and inside onload function window.print() is called to open the operating system printer dialog box.

Edge Version:
Microsoft Edge 40.15063.0.0
Microsoft EdgeHTML 15.15063

My code snippet :
first.html
<html>
<script language="JavaScript">
function openPageTwo()
{
window.open('two.html’,’PopupPage’, ‘height=800,width=950,scrollbars=yes,resizable=yes,menubar=1’);
}
</script>
<a href="javascript:openPageTwo()">Open Page Two</a>
</html>

two.html
<html>
<script language="JavaScript">
window.onload = function()
{
window.print();
}
</script>
<p>my content
</html>

when we click “Open Page Two” sometimes operating printer dialog box is opening but most of the times it is not opening.

below is the console error in developer tools,
SCRIPT65535: Unexpected call to method or property access.
preview.js (358,1)
Line No 358 in preview.js --> Printer.startPrint();

Any help would be greatly appreciated

Attachments

0 attachments

    Comments and activity

    • Hi Kaviyarasan,

      I will take a look at this.

      Is that the complete repro code?  Nothing in the headers?

      Will you provide the extended version of Windows 10 you are using?  Win + S and type “winver” and hit enter.

      Steve

    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

    • Hi Kaviyarasan,

      I was not able to repro this issue in 16299.371.  I also did more research on this issue and realized that 16299.371 does not appear to use the preview.js javascript file.  I.e. there apparently have been changes to the print module since 15063.

      I found this posting about this issue being fixed in 16299.

      https://social.msdn.microsoft.com/Forums/vstudio/en-US/f55ef556-6470-453a-8879-e56828cd1841/windowprint-is-not-working-in-microsoft-edge-browser?forum=scripting

      I will mark this as 'fixed’.  If you are not able to upgrade you Windows 10 version, I recommend contacting our business support team.

      https://support.microsoft.com/en-us/gp/support-options-for-business 

      Appreciate the submission and the support,

      Steve

    • Microsoft Edge Team

      Changed Status to “Confirmed”

      Changed Status from “Confirmed” to “Fixed”

    You need to sign in to your Microsoft account to add a comment.

    Sign in