-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 seconds delay is seen with Page navigation using WebView2 & SetVirtualHostNameToFolderMapping #2381
Comments
Couple of other points:
|
Yes it looks like there's still a part of the code trying to resolve the hostname. Good bug thanks! If you pick a name that causes hostname resolution to just wait and timeout after 2s you'll see that when navigating to a SetVirtualHostNameToFolderMapping URI. For example, if you use app.local or anything .local you'll see this behavior. As a workaround if you pick the special TLD |
Now when debugging, we will display the interface using the node dev server for debug features such as live code editing. This may introduce some issues (#11) but we shall try anyways and see, since it benefits development. + minor perf. improvement when not using the local domain when using SetVirtualHostNameToFolderMapping. See related issue: MicrosoftEdge/WebView2Feedback#2381
Thank you so much. :) I spent 4 hours using
But i did not use |
The SetVirtualHostName and file: URIs are handled by the browser process. The WebResourceRequested event raises its event to you on the WebView2 UI thread in your host app. This means the WebResourceRequested event will be potentially much slower because it has a second process hop and it has to wait for the UI thread to be available. If all you need is to access local files, SetVirtualHostName or file: URIs are a better option than WebResourceRequested. But if you need the flexibility of providing your own custom stream then WebResourceRequested is required. |
Yes, I embed all static resources( |
Thank you @VAllens for the suggested workaround using Also note that using NavigateToString is extremely fast and I can even load the entire google.com search page in 1.2s. It's only the WebResourceRequested approach that has this issue, possibly only when using a real looking http(s) url. |
@david-risney , i'm facing the same slow loading when using any hostName rather then "app.example", despite the issue was reported in 2022 why it still exist till today in 2024 ? ( and btw i'm using the latest version of webiew2 for wpf ) |
Is there any progress on this issue? |
Any updates on this issue? |
Description
When we load a local page using SetVirtualHostNameToFolderMapping and the domain is non-existent we see a 2 secondsdelay in the page navigation to complete.
Version
SDK: 1.0.1185.39
Runtime: 100.0.1185.44
Framework: WPF
OS: Win10
Repro Steps
Note that the page loads after 2 seconds delay. That can be seen by taking the difference in timestamps logged in NavigationCompleted and NavigationStarting events.
Workaround
If we add a host file entry mapping valid IP address (machine's IP) and virtual hostname (provided in SetVirtualHostNameToFolderMapping), the page loads fine without any delay.
Additional context
It looks like it is trying to reach the host and causes the timeout.
AB#39415297
The text was updated successfully, but these errors were encountered: