Skip to content

[Problem/Bug]: SourceChanged event is missing in a specific scenario #5489

@jls28

Description

@jls28

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:blank to https://en.wikipedia.org,
    the sample displays the URL as https://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 as https://en.wikipedia.org
    because no SourceChanged event is raised in this specific case.
    But this displayed URL is incorrect — the actual location.href (checked via JavaScript) is still
    https://en.wikipedia.org/wiki/Main_Page because 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions