-
Notifications
You must be signed in to change notification settings - Fork 64
Description
The SourceChanged event is missing in a specific scenario.
When navigating to https://en.wikipedia.org from https://en.wikipedia.org/wiki/Main_Page,
no SourceChanged event is raised.
This is likely because https://en.wikipedia.org is immediately redirected to https://en.wikipedia.org/wiki/Main_Page.
But is this behavior actually correct?
I’m not convinced. It causes issues in my application, and it even affects one of the official WebView2 samples.
For example, in the official WebView2APISample:
-
If I navigate from
about:blanktohttps://en.wikipedia.org,
the sample displays the URL ashttps://en.wikipedia.org/wiki/Main_Page,
because a SourceChanged event is raised (and this URL is correct). -
However, if I then use the address bar to navigate again to
https://en.wikipedia.org(from the previous page
https://en.wikipedia.org/wiki/Main_Page), the sample displays the URL ashttps://en.wikipedia.org
because no SourceChanged event is raised in this specific case.
But this displayed URL is incorrect — the actuallocation.href(checked via JavaScript) is still
https://en.wikipedia.org/wiki/Main_Pagebecause of the redirection.
This problem is not limited to Wikipedia;
I think many other URLs that perform a redirection are affected :
https://msdn.microsoft.com/magazine/jj618294.aspx
https://google.com
https://httpbin.org/redirect-to?url=https://example.com
https://developer.mozilla.org
...
msEdge is not affected by this problem.