KristofferStrube/Blazor.FileSystemAccess

Doesn't work in Brave browser

tesar-tech opened this issue · 3 comments

Brave browser has some security "features" which may block this. But i didn't investigate..

When I access the demo page, this is shown in console:

Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.

after clicking "Open file picker..." button it shows this:

Microsoft.JSInterop.JSException: Could not find 'window.showOpenFilePicker' ('showOpenFilePicker' was undefined).
blazor.webassembly.js:1 Error: Could not find 'window.showOpenFilePicker' ('showOpenFilePicker' was undefined).
blazor.webassembly.js:1     at https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/blazor.webassembly.js:1:328
blazor.webassembly.js:1     at Array.forEach (<anonymous>)
blazor.webassembly.js:1     at a.findFunction (https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/blazor.webassembly.js:1:296)
blazor.webassembly.js:1     at _ (https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/blazor.webassembly.js:1:2437)
blazor.webassembly.js:1     at https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/blazor.webassembly.js:1:3325
blazor.webassembly.js:1     at new Promise (<anonymous>)
blazor.webassembly.js:1     at Object.beginInvokeJSFromDotNet (https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/blazor.webassembly.js:1:3306)
blazor.webassembly.js:1     at Object.Rt [as invokeJSFromDotNet] (https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/blazor.webassembly.js:1:59738)
blazor.webassembly.js:1     at _mono_wasm_invoke_js_blazor (https://kristofferstrube.github.io/Blazor.FileSystemAccess/_framework/dotnet.6.0.2.0c4ewytdwm.js:1:194973)
blazor.webassembly.js:1     at wasm://wasm/00970812:wasm-function[219]:0x1a129
blazor.webassembly.js:1    at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.IJSObjectReference, Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
blazor.webassembly.js:1    at KristofferStrube.Blazor.FileSystemAccess.FileSystemAccessService.ShowOpenFilePickerAsync(OpenFilePickerOptions openFilePickerOptions)
blazor.webassembly.js:1    at KristofferStrube.Blazor.FileSystemAccess.WasmExample.Pages.Index.OpenFilePicker()

This file: https://kristofferstrube.github.io/Blazor.FileSystemAccess/_content/KristofferStrube.Blazor.FileSystemAccess/KristofferStrube.Blazor.FileSystemAccess.js is loaded.

As far as I can see the File System Access API is intentionally not supported in Brave even though they target a version of Chromium that supports it.
Source: brave/brave-browser#11407

This can though be enabled using the following flag that I found:
brave://flags/#file-system-access-api

I ran into this as well. Glad to see a workaround is already documented! Seems like the API is also not supported in Safari & Firefox according to https://caniuse.com/?search=showopenfilepicker