Skip to content

[Problem/Bug]: Download page does not close automatically after download completes #5256

Open
@dhveerap

Description

@dhveerap

What happened?

Download link with target _blank opens a new download window but does not close it automatically.
PFB for repro steps.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Win32

Operating System

Windows 11

OS Version

No response

Repro steps

  • Open WV2 app
  • Navigate to below HTML page
<!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>
  • Click download link
  • Expected: The download page opens & closes automatically + downloads the file in some visible way
  • Actual: The download page opens but does not close automatically

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

No response

Metadata

Metadata

Labels

bugSomething isn't workingregressionSomething used to work but doesn't anymoretrackedWe are tracking this work internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions