Skip to content

[Problem/Bug]: Download fails on JS /w newpage #5196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MichaeI-GH opened this issue Apr 9, 2025 · 15 comments
Open

[Problem/Bug]: Download fails on JS /w newpage #5196

MichaeI-GH opened this issue Apr 9, 2025 · 15 comments
Assignees
Labels
bug Something isn't working regression Something used to work but doesn't anymore tracked We are tracking this work internally.

Comments

@MichaeI-GH
Copy link

MichaeI-GH commented Apr 9, 2025

What happened?

Hi,
this occurred in an externally developed app of ours.

here's the examplecode I used:
(Here it's a .bin-File but in our Application it is a .doc file, both fail.)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Download Resource and Open in New Tab</title>
</head>
<body>
    <h1>Download and Open in New Tab Example</h1>
    <a href="javascript:void(0)" onclick="openInNewTab()">Click me to open the resource in a new tab</a>

    <script>
        function openInNewTab() {
            const url = "https://hil-speed.hetzner.com/100MB.bin";
            const a = document.createElement('a');
            a.href = url;
            a.target = "_blank"; // Opens in a new tab
            a.download = "100MB.bin"; // Suggests a filename for download
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
        }
    </script>
</body>
</html>

Thanks!

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

135.0.3179.54

SDK Version

1.0.3230-prerelease

Framework

Winforms

Operating System

Windows 11

OS Version

22631.5039

Repro steps

  1. (Get an example website, if not already available)
  2. Open WV2 app
  3. Klick Download link
    Expected: The page opens & closes automatically + downloads the file in some visible way
    Actual: The page opens but nothing else seems to happen

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

134.0.3124.93

@MichaeI-GH MichaeI-GH added the bug Something isn't working label Apr 9, 2025
@github-actions github-actions bot added the regression Something used to work but doesn't anymore label Apr 9, 2025
@PhilipRieck
Copy link

PhilipRieck commented Apr 9, 2025

We are seeing the same behavior, and this is highly impactful to users.

Can confirm:
Working in 134.0.3124.93
Regression in 135.0.3179.54

Simply installing 135.0.3179.54 causes the issue to manifest.

In our application, one way we are using webview2 is to allow the user to access Sql Server Reporting Services. On clicking 'export to excel', the file download starts but never completes.

@ParadoxZero
Copy link

@PhilipRieck @MichaeI-GH
Are you folks using any specific app framework? Because the provided html worked fine for me in win32 sample app.

v135.0.3179.54

@ParadoxZero
Copy link

ParadoxZero commented Apr 10, 2025

20250410-0346-38.0891527.mp4

This is how I tested it.

Please check if there are any crashes here. Either visit "edge://crashes" from the webview or find dumps in the User data folder. For more details - https://github.com/MicrosoftEdge/WebView2Feedback/blob/main/diagnostics/crash.md

@ParadoxZero ParadoxZero self-assigned this Apr 10, 2025
@MichaeI-GH
Copy link
Author

As mentioned, we are using WinForms. If that's not what you're asking, please elaborate.

The edge://crashes-page does not provide any crashes afterwards.

To me it seems that the new tab opened by JS blocks the download.

@kentrob
Copy link

kentrob commented Apr 10, 2025

We are using the WPF control and seeing the same issue. What seems to happen is that a .tmp extension file is created in the Downloads directory but the process never completes and we are left with a gray window and the user never sees the downloads message. If you rename the .tmp file to the extension you were expecting (xlsx/pdf etc), the file is complete and useable.

@janhavel1
Copy link

Hello,

we have the same experience, we are also using WebView2 to host Reporting services reports; and now Export to Excel stopped working.

WebView2 initialized from Microsoft.WebView2.FixedVersionRuntime.134.0.3124.93.x64.cab works,
WebView2 initialized from Microsoft.WebView2.FixedVersionRuntime.135.0.3179.54.x64.cab it does not work.

I was able to reproduce it by running your WebView2WindowsFormsBrowser sample (https://github.com/MicrosoftEdge/WebView2Samples) and navigating it to a public Reporting Services report at https://ssrs.fdot.gov/Reports/report/PDA%20Reports/Public%20Reports/ShortList

Image

Please have a look what has changed and fix it.
Thank you very much.
Regards
Jan

@AceCoderLaura
Copy link

Same issue for us on SDK 1.0.1150.38 and runtime 135.0.3179.54.
Issue doesn't occur on runtime 134.0.3124.93.

@heinzik
Copy link

heinzik commented Apr 11, 2025

Same issue for us

@gabrielrvd
Copy link

gabrielrvd commented Apr 11, 2025

Same issue than @janhavel1 here, WPF sdk 135 not work and 134 works

@maxsukholovyy
Copy link

Same issue for us

@JamieBurm
Copy link

We're using this in our software products and now have clients hitting this issue and complaining. This is going to start affecting a lot of people so an indication on when this may be fixed would be much appreciated.

@iamalexninov
Copy link

@ParadoxZero some information for all of us. What is happening, are you working on the issues and how to continue from now, because our clients complaining about this issue?

@LaughingJohn
Copy link

Just wanted to add my voice. We have the same problem as @janhavel1 with report server. We host report viewer in a webview2 in WPF. We're starting to get more and more complaints from our clients as the new webview2 version rolls out...

@aledeniz
Copy link

+1
same issue with us unfortunately. We observed it after 135.0.3179.73, but we may have not deployed 135.0.3179.54.

The navigation to download pdf, xls, doc, .. all formats is broken.

@fabiorocha fabiorocha added the tracked We are tracking this work internally. label Apr 14, 2025
@ParadoxZero
Copy link

Folks, I managed to repro and understand the issue. Thanks a lot for all the help with diagnostics. Will update the thread once the fix has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something used to work but doesn't anymore tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests