-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Labels
bugSomething isn't workingSomething isn't workingpriority-lowWe have considered this issue and decided that we will not be able to address it in the near future.We have considered this issue and decided that we will not be able to address it in the near future.trackedWe are tracking this work internally.We are tracking this work internally.
Description
Setup
- WPF application
- .Net 4.7.2
- 0.9.579-prerelease package for WebView
- Edge Dev installed
Problem
When a user navigates inside the browser we can subscribe to the NavigationStarted event which holds the property IsUserInitiated. When the user moves forwards/backwards in th browser this property is expected to be true, but this is not the case.
Code
I have created a minimum viable example which can reproduce the issue. Create a new WPF app with the following code:
MainWindow.xaml
<Window x:Class="TestWebView2App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mc:Ignorable="d"
Title="MainWindow" Height="800" Width="1000">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<wv2:WebView2 Name="WebView"
Source="http://microsoft.com" />
<ScrollViewer Height="150"
Grid.Row="1">
<TextBox x:Name="WebViewEvents"
Text="*** EVENT OVERVIEW ***"
Foreground="OrangeRed"
Background="Black"
IsReadOnly="True" />
</ScrollViewer>
</Grid>
</Window>
MainWindow.xaml.cs
using System;
using System.Windows;
namespace TestWebView2App
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
WebView.CoreWebView2Ready += WebView_CoreWebView2Ready;
}
private void WebView_CoreWebView2Ready(object sender, EventArgs e)
{
WebView.CoreWebView2.NavigationStarting += CoreWebView2_WebView_NavigationStarting;
}
private void CoreWebView2_WebView_NavigationStarting(object sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationStartingEventArgs e)
{
WebViewEvents.Text += Environment.NewLine + $"Navigation to '{e.Uri}', is from user: '{e.IsUserInitiated}'";
}
}
}
How to reproduce
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority-lowWe have considered this issue and decided that we will not be able to address it in the near future.We have considered this issue and decided that we will not be able to address it in the near future.trackedWe are tracking this work internally.We are tracking this work internally.