vendredi 28 septembre 2018

Turning off both browser autocomplete(history based) and autofill (context based)

I've a (generic) widget which provides its own suggestions to assist user in selecting a value for that form field. The problem is that browser autofill and autocomplete suggestions obstruct my widget's popup from making a selection.

From what I've observed while playing with google chrome browser, setting autocomplete="off" turns off the history based autocomplete feature. Setting autocomplete="some-value-browsers-don't-understand" turns off the context based autofill feature. I need to turn off both these features, and the problem here is that same autocomplete attribute on input element is being used for two different purposes by the browsers.

Is there a way to turn off both autocomplete and autofill feature of the browsers that works in all major browsers? If needed I can drop the name attribute on my input element if it can help achieve a solution for this. From my observations, even without the name attribute on the input element, the browser does try to provide autofill suggestions.

PS 1: This question is different from the ones answered earlier here in SO, the other questions don't address both these problems together.

PS 2: As per WHATWG spec, if the application provides its own autocomplete mechanism, then autocomplete="off" needs to be set on the input element. But obviously looks like google chrome (and possibly others) doesn't honor this.




Aucun commentaire:

Enregistrer un commentaire