3
votes

I have a Xamarin forms WebView that loads a webpage using Source = "myInternalSite.CompanySite.com" that has an HTML input text field inside an HTML form.

Here is what is happening. A user types something in the input field and submits it. Then later they come back in and start typing again and a drop down appears on the input field with the last thing typed in.
(In chrome there is a setting "Enable Autofill to fill out web forms in a single click" and in edge "Save form entries")

How can I disable auto fill for HTML forms in a Xamarin forms WebView?

Or does this have to be done in the HTML

1

1 Answers

3
votes

That depends on how exactly you load a webpage. If you do something like this:

var browser = new WebView {
    Source = "http://xamarin.com"
};

Then you are out of luck because you simply don't have control over HTML elements in a webpage that you are displaying.

However, if you are constructing webpage yourself like this:

var browser = new WebView();
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"<html><body>
    <h1>Xamarin.Forms</h1>
    <p>Welcome to WebView.</p>
    </body></html>";
browser.Source = htmlSource;

Then you can use those attributes to control the autocomplete feature:

<input autocomplete="off"/>

or

<textarea autocomplete="off"/>