3

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?

noel
  • 531
  • 2
  • 7
  • It could be a security aspect on `Brave` browser that is preventing this behavior to happen. Have you tried this with other browsers to see if the outcome is the same? – Rahul Sharma Mar 11 '22 at 18:21
  • In another situation, I have had to fully qualify the path name of the rest call. Don't know if that applies...but... – ΩmegaMan Mar 11 '22 at 21:53
  • @RahulSharma I´ve tried Edge, Chrome and FireFox so far and none of them have the same issue. I tried giving the page every permission available in Brave and also deactivated Brave shield and all my extensions. To no avail. – noel Mar 14 '22 at 12:03
  • @ΩmegaMan Do you mean in the download attribute? What would that look like, since the file doesn´t really exist in a file system? – noel Mar 14 '22 at 12:07
  • @noel Maybe this could shed some light on your issue: https://github.com/brave/brave-browser/issues/15410 – Rahul Sharma Mar 14 '22 at 12:28
  • It doesn't apply. NVM. :-/ – ΩmegaMan Mar 14 '22 at 13:25

0 Answers0