Xamarin Forms WebView disable autocomplete

I have a Xamarin forms WebView

that loads a webpage using Source = "myInternalSite.CompanySite.com"

that has an HTML input textbox in an HTML form.

Here's what's going on. The user enters something into the input field and submits it. They then go back and start typing again, and a drop-down message appears in the input field with the last information entered.
(Chrome has an option "Turn on autocomplete to fill out web forms with one click" and at the end "Save form entries")

How can I turn off auto-fill for HTML forms in a Xamarin WebView form?

Or should it be done in HTML

+3


source to share


1 answer


It depends on exactly how you load the web page. If you do something like this:

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

      

Then you are out of luck, because you simply have no control over the HTML elements in the web page you are displaying.

However, if you create a web page 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 these attributes to control the function autocomplete

:

<input autocomplete="off"/>

      

or

<textarea autocomplete="off"/>

      

+3


source







All Articles