WebWindow
WebWindow copied to clipboard
Option to pass userDataFolder value into CreateWebView2EnvironmentWithDetails
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.
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
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.
If anyone still comes along this way. The error can be resolved by installing the Edge Dev channel version of the browser.
@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()