Hi Forum,
I have a program that uses webview2, which loads a local HTML file. Since loading local HTML files requires an absolute path, I obtained the absolute path in the program and displayed it normally.
But when I packaged all the files together, webview2 couldn't display it anymore.
Program directory structure:
- FormMain.cs
- wwwroot
- - index.html
Load the code for the HTML section:
string exePath = AppDomain.CurrentDomain.BaseDirectory;
string relativePath = "wwwroot/index.html";
string path = System.IO.Path.Combine(exePath, relativePath);
WebView21.Source = new Uri(@"file:///" + path);
I guess after packaging it into an exe, webview2 cannot load the contents of wwwroot in the current folder.
May I ask if any relevant configurations need to be made during packaging to solve this problem?
Can not find visit a absolute path local file whith webview2
-
1047890434@qq.com
- Posts: 1
- Joined: Fri Aug 23, 2024 1:08 am
Re: Can not find visit a absolute path local file whith webview2
Hi, packed file has to behave same way as non packed, so you should not do any additional configuration to EVB to make this work.
Please note, in some cases, webview may require to enable all checkboxes on Options panel.
If this does not help, please send us your test files (non packed) at support@enigmaprotector.com, we will check it out.
Please note, in some cases, webview may require to enable all checkboxes on Options panel.
If this does not help, please send us your test files (non packed) at support@enigmaprotector.com, we will check it out.
