Not allowed to load local resource #239

Closed
opened 2026-01-29 16:34:31 +00:00 by claunia · 1 comment
Owner

Originally created by @Fuewburvpoa on GitHub (Dec 8, 2018).

I want to make small photo library app for myself, and i get this error "Not allowed to load local resource".
In chromium based browser i simply pass "--allow-file-access-from-files" as argument to load files from local storage, but how do i do it there?

I've tried to pass it there
Electron.App.CommandLineAppendArgument("--allow-file-access-from-files");
but no result.

Originally created by @Fuewburvpoa on GitHub (Dec 8, 2018). I want to make small photo library app for myself, and i get this error "Not allowed to load local resource". In chromium based browser i simply pass "--allow-file-access-from-files" as argument to load files from local storage, but how do i do it there? I've tried to pass it there `Electron.App.CommandLineAppendArgument("--allow-file-access-from-files");` but no result.
Author
Owner

@Fuewburvpoa commented on GitHub (Dec 9, 2018):

Found the solution there.

 var options = new BrowserWindowOptions
 {
     WebPreferences = new WebPreferences
     {
         WebSecurity = false
     }
 };
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync(options));
@Fuewburvpoa commented on GitHub (Dec 9, 2018): Found the solution [there](http://www.cross-platform-blog.com/electron.net/electron.net-musicplayer-app-with-asp.net-core/). ``` var options = new BrowserWindowOptions { WebPreferences = new WebPreferences { WebSecurity = false } }; Task.Run(async () => await Electron.WindowManager.CreateWindowAsync(options)); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#239