0

I have a text input and a password input which Chrome often asks to remember the info for to autofill. The issue is that it doesn't autofill that information.

How do I get this to work?

It is a single page app, and all request are made via AJAX.

Hence, my inputs are as simple as:

<input type="text" placeholder="email" autocomplete="on" />
<input type="password" placeholder="password" autocomplete="on" />

I thought that the autocomplete="on" would solve it, but maybe it is because I don't use forms? Probably a bad practice of mine since all I do are Ajax requests, but how would I get this to work?

David
  • 7,028
  • 10
  • 48
  • 95

1 Answers1

1

Chrome parses forms to autofill. So you have to put a <form> element around it, just don't add a submit input element and the form will not bother you.

See also this answer: How to trigger Autofill in Google Chrome?

From that anwer:

As pointed out in these insightful answers, all the regular expressions Chrome uses to identify/recognize common fields can be found in autofill_regex_constants.cc.utf8. So to answer the original question, just make sure the names for your html fields get matched by these expressions. Some examples include:

  • first name: "first.*name|initials|fname|first$"
  • last name: "last.*name|lname|surname|last$|secondname|family.*name"
  • email: "e.?mail"
  • address (line 1): "address.*line|address1|addr1|street"
  • zipcode: "zip|postal|post.*code|pcode|^1z$"
Community
  • 1
  • 1
Niki van Stein
  • 10,564
  • 3
  • 29
  • 62