Skip to content

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

Open
@MichaeI-GH

Description

@MichaeI-GH

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

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