web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Code Component for pri...
Power Apps
Unanswered

Code Component for printing stopped working; popup closes fast

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I've successfully created a Code Component to print from a screen a few months ago. The user clicks a button to launch the Print dialog. It formats and prints data from the screen. All good.

Just recently, when using Edge, when I click the button, the print dialog flashes open then closes instantly. However, it works in IE, Chrome, and Firefox. 

Any ideas?

I have the same question (0)
  • cchannon Profile Picture
    4,702 Moderator on at

    Two options:

    • Debug and find the JS operation that is not playing nicely with Edge any more, then branch that section based on current browser (navigator.userAgent works well, but no approach is perfect) or,
    • Switch to New Edge and pretend none of this ever happened.
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Resolver. Thanks for your reply.

    I AM using the chromium-based Edge browser. (Microsoft EdgeVersion 89.0.774.54 (Official build) (64-bit)) That's what's odd. Chrome works fine.

    So, it must be something in the TypeScript. There is a line that looks suspicious:

    popupWin.document.close();
  • cchannon Profile Picture
    4,702 Moderator on at

    There are a million JS commands that could cause browser incompatibility issues. document.close seems like an unlikely one, but I have been wrong in my career as often as I've been right, so if it looks to you like a good suspect, go ahead and dig in.

     

    That said, I would also advise that TS (and your react app, if you have one) get rendered as JS before the code is run on your model driven app, so don't google search your TS; it could lead you astray. Debug the compiled JS step by step in the browser until you find the line that is causing your problem then search that function/operation to see if you can find something more browser-agnostic.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It was me 😞

    Missed the right bracket at the end of this line:

    <body onload="window.print();window.close()">;
     
    Evidently, Edge handled this error differently than Chrome, Firefox, and Internet Explorer.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard