79194310

Date: 2024-11-16 00:40:30
Score: 2
Natty:
Report link

Complementing the answer, the webview configured as autofill in Blazor can be easily disabled if the MainPage that dictates the blazor route is defined as:

    public partial class MainPage : ContentPage
{
    public MainPage()
    {
        Loaded += MainPage_Loaded;
        InitializeComponent();
    }
    

    private async void MainPage_Loaded(object? sender, EventArgs e)
    {
#if WINDOWS
        await (blazorWebView.Handler.PlatformView as Microsoft.UI.Xaml.Controls.WebView2).EnsureCoreWebView2Async();

        (blazorWebView.Handler.PlatformView as Microsoft.UI.Xaml.Controls.WebView2).CoreWebView2.Settings.IsGeneralAutofillEnabled = false;
#endif
    }
}

The CoreWebView2 component starts asynchronously, so it is necessary to use await and the EnsureCoreWebView2Async() method before manipulating its properties.

Other references: Why my coreWebView2 which is object of webView2 is null?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Matheus G. P. S.