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

Closed
MichaeI-GH opened this issue Apr 9, 2025 · 24 comments
Closed

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

MichaeI-GH opened this issue Apr 9, 2025 · 24 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.

@ParadoxZero
Copy link

The fix is available in version >= 137.0.3269.0. Please help me validate this.

@DGrillonLCL
Copy link

Tested using Canary 137.0.3275.0 and ChannelSearchKind registry key

Work well when downloading PDF files

@FMI-ATL
Copy link

FMI-ATL commented Apr 22, 2025

@ParadoxZero, hello
Same problem for me !
Edge need to be updated on my computer ? or WebView2 ?
Where can I download WebView2 fixed version ?

@MichaeI-GH
Copy link
Author

Also works for me on Canary, version 137.0.3275.0, using CoreWebView2ChannelSearchKind.LeastStable!

From what I recall, the window usually closes after starting the download & opens the downloads-popup in the original tab (like it does in Edge), which would be nice.

When do you plan on shipping this on stable?

@mgMsquared
Copy link

Interestingly I'm able to "view" pdf files.
if html page contains ... <a href="https://demo.com/mydoc.pdf" target="_blank" >mydoc.pdf</a>
However if the ext is .doc or .dotx .docx (Basically any office doc) I don't get download prompt.. just a {guid}.tmp is created in downloads folder
( If I rename the {guid}.tmp file ... to x.doc or what ever the original extension is ... file is valid)

If I right click on link/href tag I'm able to download file w/o issues.

btw CoreWebView2.DownloadStarting doesn't fire..
As other have mentioned.. it work in Edge as expected.

@mgMsquared
Copy link

The fix is available in version >= 137.0.3269.0. Please help me validate this.

Verified it works in 137.0.3281.0 (latest canary build at this time)
also (download) of .dotx .docx files works.

@ParadoxZero
Copy link

The fix has been cherry-picked to version >= 136.0.3240.37. It should go out to stable by end of the week. Everyone should be receiving updates by next week.

@ParadoxZero
Copy link

Closing the issue as fixed.

@exaiwitmx
Copy link

There seems to be more to it than just this fix.

I have two different versions of our application:

Old version of our application using Microsoft.Web.WebView2 1.0.705.50:

  • Canary 137.0.3288.0: Problem occurs
  • Stable 135.0.3179.85: Problem occurs
  • Old Fixed 134.0.3124.93: Problem does not occur

New version of our application using Microsoft.Web.WebView2 1.0.1418.22

  • Canary 137.0.3288.0: Problem does not occur
  • Stable 135.0.3179.85: Problem does not occur
  • Old Fixed 134.0.3124.93: Problem does not occur

I've verified that the versions given here were actually used when testing (by means of ProcessExplorer, which shows the msedgewebview2.exe-Processes created by our application.

As these versions of our application do not only differ in the version of Microsoft.Web.WebView2 they use, but also in the implementation of WebView2 integration, I do not know whether it is related to the version of Microsoft.Web.WebView2 or some other differences.
To narrow it down, I could upgrade the old application version to the newer version of Microsoft.Web.WebView2.

Fortunately, I do not need a fix for the old version of our application.

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