Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Option to pass userDataFolder value into CreateWebView2EnvironmentWithDetails #100

Open
bretehlert opened this issue Apr 8, 2020 · 4 comments

Comments

@bretehlert
Copy link

Thank you for this awesome prototype!

Creating a WebWindow on Windows causes a folder to be created next to the running exe with a name like foo.exe.WebView2 for program foo.exe. This causes an "Access is deined." error if the user does not have permission to write files next to the running exe, as would be the case if the program is deployed as programs normally are, such as to the Program Files directory.

It appears that this is the WebView2 userDataFolder, the location of which can be set using the second parameter of CreateWebView2EnvironmentWithDetails(). To manage this correctly we should add a field to the WebWindowOptions class to set a custom path that can be propagated down to the call to CreateWebView2EnvironmentWithDetails(). We might also consider defaulting the value to a path under the user's program data directory.

@daniel-scatigno
Copy link

Well I endorse this option, there should be an option to specify the data folder.
This is needed specially when you use multiple browsers for different purposes (different cookies)

I'm running on linux and I don't have any idea where this folder is stored, and it's not on executables folder. Perhaps under /home/username/.local/share/webkitgtk/ folder

@bretehlert
Copy link
Author

For our purposes we have ended up modifying the code in WebWindow.Windows.cpp to generate a unique temp directory to pass into CreateWebView2EnvironmentWithDetails() and have implemented the IDisposable pattern to cleanup this temp directory in Dispose().

I have not yet looked at all into the Linux implementation to see if there is an equivalent issue and fix.

@philippjbauer
Copy link

If anyone still comes along this way. The error can be resolved by installing the Edge Dev channel version of the browser.

@Smurf-IV
Copy link

@philippjbauer FYI: Using the new Photino.Blazor project and win10 Edge 1809 VM (With updates) and the Edge Dev V 90.0.8 does not work out of the box.
How does the code example gain access to CreateWebView2EnvironmentWithDetails()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants