1 year ago

#280532

test-img

noel

File download issue with Blazor server and Brave

When I try to create and download a file from memory with Blazor server it works without issue in both Edge and Chrome.

But if I try the same thing in Brave I´m getting this:

Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 (no reason given).'.

EDIT: I should add that the download window does open in Brave and the file is being downloaded correctly. The websocket error occurs immediatly afterwards.

This is the js function I tested it with.

function myFunction() {
    let utf8Encode = new TextEncoder();
    let myBuffer = utf8Encode.encode("abc")

    var blob = new Blob([myBuffer], { type: "application/octet-stream" });
    var link = document.createElement('a');
    link.href = window.URL.createObjectURL(blob);
    link.download = "test.txt";
    link.click();
}

Which I call from the index.razor of the WeatherForecast template (.Net 6)

await JS.InvokeVoidAsync("myFunction");

I tried running the server in IIS or Docker instead, same result. Is there a way to get more information about the websocket error?

c#

signalr

blazor-server-side

brave

0 Answers

Your Answer

Accepted video resources