WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

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

Open MichaeI-GH opened this issue 8 months ago • 10 comments

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 avatar Apr 09 '25 11:04 MichaeI-GH

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.

PhilipRieck avatar Apr 09 '25 16:04 PhilipRieck

@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 avatar Apr 10 '25 03:04 ParadoxZero

https://github.com/user-attachments/assets/2b54ca46-e262-4884-b381-d73988bc2966

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 avatar Apr 10 '25 03:04 ParadoxZero

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.

MichaeI-GH avatar Apr 10 '25 07:04 MichaeI-GH

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.

kentrob avatar Apr 10 '25 10:04 kentrob

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

janhavel1 avatar Apr 10 '25 16:04 janhavel1

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.

AceCoderLaura avatar Apr 11 '25 04:04 AceCoderLaura

Same issue for us

heinzik avatar Apr 11 '25 11:04 heinzik

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

gabrielrvd avatar Apr 11 '25 12:04 gabrielrvd

Same issue for us

maxsukholovyy avatar Apr 11 '25 15:04 maxsukholovyy

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.

JamieBurm avatar Apr 13 '25 23:04 JamieBurm

@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?

iamalexninov avatar Apr 14 '25 06:04 iamalexninov

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...

LaughingJohn avatar Apr 14 '25 09:04 LaughingJohn

+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.

aledeniz avatar Apr 14 '25 14:04 aledeniz

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 avatar Apr 15 '25 05:04 ParadoxZero

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

ParadoxZero avatar Apr 21 '25 03:04 ParadoxZero

Tested using Canary 137.0.3275.0 and ChannelSearchKind registry key

Work well when downloading PDF files

DGrillonLCL avatar Apr 22 '25 07:04 DGrillonLCL

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

FMI-ATL avatar Apr 22 '25 10:04 FMI-ATL

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?

MichaeI-GH avatar Apr 22 '25 11:04 MichaeI-GH

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 avatar Apr 25 '25 02:04 mgMsquared

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.

mgMsquared avatar Apr 25 '25 12:04 mgMsquared

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 avatar Apr 28 '25 02:04 ParadoxZero

Closing the issue as fixed.

ParadoxZero avatar Apr 28 '25 02:04 ParadoxZero

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.

exaiwitmx avatar Apr 29 '25 12:04 exaiwitmx

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.

I do with both versions are not working

Winform Microsoft Web,Webview2 1.0.2535.41 Stable 135.0.3179.85 : Status = problem occurs with new window download file

Winform Microsoft Web,Webview2 1.0.3179.45 Stable 135.0.3179.85 : Status = problem occurs with new window download file

syaifurihadi avatar May 02 '25 02:05 syaifurihadi

Can anyone confirm if it is fixed in Version 136.0.3240.50? I can still recreate the same download issue where a .tmp file is being created in the downloads folder and not completing the download.

rishabgt avatar May 07 '25 16:05 rishabgt

@ParadoxZero

rishabgt avatar May 07 '25 16:05 rishabgt

@rishabgt Version 136.0.3240.64 fixed it for me

DGrillonLCL avatar May 09 '25 12:05 DGrillonLCL

I just attempted Version 136.0.3240.64 and it didn't work for me.

Does anyone have a Fixed Version of 134? I can't seem to find one anywhere.

SadgeCode avatar May 11 '25 04:05 SadgeCode

Folks,

Please confirm a few things for me - Is the symptom being experienced is the same as described above? Otherwise please share your individual repro steps to understand if it's a different issue or an extension of the same.

I do not expect a change in SDK version to have an effect here. If it does, it might be a different problem altogether masquerading as the original bug.

ParadoxZero avatar May 11 '25 12:05 ParadoxZero