Open file after downloaded to download folder

63 views Asked by At

Within my MAUI Blazor hybrid project, I have a button that downloads an Excel file. Is it possible to open this Excel file? It is placed in the downloads folder.

How to get the path for downloads folder on multiple devices? Each username is different.

private async Task TableToExcel()
{
    await JS.InvokeAsync<string>("tableToExcel", "tablename", "name", "excelfile.xls");
}
1

There are 1 answers

0
Emperor Eto On

It is not possible for Javascript (or Webassembly, etc.) to force a modern browser to open a file upon download. Blazor Hybrid apps use WebView2 which is essentially Microsoft Edge, so you're sandboxed the same way you would be if you were making a web app. The best you can do is provide appropriate prompts to your users.