Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome email field autocomplete options not showing for my website

As I visit many new websites for the first time, I see that:

  1. For some websites, putting my cursor in the email field of signup form immediately shows me email options from what I had entered in other websites.
  2. For other websites, putting my cursor in the email field does not give me any email options. And, I have to manually type every letter of the email.

I couldn't find what piece of code differentiates the two cases. For my website, I am stuck with #2. I am trying to achieve #1, where user can just re-use emails entered in other websites.

I used some code like this:

<input type="email" name="email" id="frmEmailA" placeholder="[email protected]" required autocomplete="email">
like image 608
user3422637 Avatar asked Feb 22 '17 11:02

user3422637


People also ask

Why autocomplete is not working in Chrome?

If the autocomplete feature is enabled but still not working, try disabling the account sync feature in the You and Google tab as mentioned previously. Click on Turn off to the right of your name and email address. Then restart Google Chrome and enable sync again.

How do I turn on autocomplete in Chrome?

Turn on autocompletions: From the control panel, select the search engine you want to edit. Click Search features from the menu on the left and then click the Autocomplete tab. Click on the slider to set Enable autocomplete to On.

Why autocomplete is not working in HTML?

The solution is simple and working perfectly in all browsers. Add disabled and autocomplete="off" attribute to the form fields( name, age, etc.) On Page Load enable the fields after few miliseconds.

Why autocomplete off is not working?

Chrome respects autocomplete=off only when there is at least one other input element in the form with any other autocomplete value. This will not work with password fields--those are handled very differently in Chrome.


3 Answers

It seems that you want to enable autocomplete, but you have specified the wrong attribute.

SYNTAX:

Autocomplete="on | off"


In order to save the email address entered for the first time though, you need to have a form tag with the attribute method="POST" on it. It is also recommended to use the autocompletetype attribute to help the browsers populate the forms more accurately.

NOTE: In some cases on older browsers you may also need to add an action if the form doesn't have one. action="javascript:void(0)" works.

An example with autocomplete on and method="POST":

<form method="POST" action="javascript:void(0)">
    <input type="email" name="email" id="frmEmailA" placeholder="[email protected]" required autocomplete="on" autocompletetype=”email”>
    <input type="submit">
</form>

An example without autocomplete and method="POST":

<form>
    <input type="email" name="email" id="frmEmailA" placeholder="[email protected]" required autocomplete="off">
    <input type="submit">
</form>

See also How to trigger Autofill in Google Chrome?

like image 148
Sam Denty Avatar answered Nov 09 '22 06:11

Sam Denty


Difference is in autocomplete attribute of input element.

Syntax : <input autocomplete="">

It allows the browser to automatically filled the input field based on the previously filled data.

Hence, In #1 value of autocomplete attribute should be on.

DEMO

E-mail: <input type="email" name="email" autocomplete="on">

In #2 value of autocomplete attribute should be off.

DEMO

E-mail: <input type="email" name="email" autocomplete="off">
like image 36
Creative Learner Avatar answered Nov 09 '22 06:11

Creative Learner


The answers so far are wrong/outdated or incomplete.

Using autocomplete="email" is perfectly valid. But the browsers do not handle it very well at the moment. In Firefox and Chrome, only the name attribute is used for autocompletion. So you should stick with name="email".

If the Chrome user really wants to have a proper autocompletion for every type that autocomplete supports, he/she has to fill out the Autofill settings. After these settings are filled, the autocompletion does not depend on the name attribute anymore, but uses the type of autocomplete. I.E. it will suggest the user's email address for fields with autocomplete="email".

So in order to have the best browser support, you should keep <input name="email" autocomplete="email" [...]>. As soon as there has been at least one submitted form with name="email" or prefilled Autofill settings, the browser should actually autocomplete your input field.

Further Resources:

  • caniuse: autocomplete attribute: on & off values
  • caniuse: input[autocomplete] (values besides on/off)

For some websites, putting my cursor in the email field of signup form immediately shows me email options from what I had entered in other websites.

I cannot reproduce that on the latest Chrome on Mac OS X. You actually have to doubleclick the input for the autocompletion to show up.

like image 23
str Avatar answered Nov 09 '22 07:11

str