2

I added autocomplete="on" in input tag:

<input autocomplete="on" type="email">

It's working fine in Firefox, but not in Chrome. How can I fix this issue?

1 Answers1

3

Looks like you need to give field-name for the autocomplete attribute:

<input autocomplete="email" type="email" />

Chrome has some settings related to it, which you might need to enable.

Moreover, for some reason, it looks like Chrome doesn't allow autocomplete="on" or autocomplete="field-name", because it is a security decision by Google, so there are a few extensions that have been made to support it:

A gist of the source is:

// Code design inspired by http://userscripts.org/scripts/show/7347 .  Not
// overriding form submit prototypes like that does because I don't know of a
// good way to do this with Isolated Worlds (see http://groups.google.com/
// group/chromium-dev/browse_thread/thread/118689ceda861163/ff25578ed3585edd )
// and I'm not sure the password manager would pick it up anyway (see comment
// below).

function enableAutocomplete()
{
    var snapshot = document.evaluate('//@autocomplete',
        document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null),
        numItems = snapshot.snapshotLength - 1;

    for (var i = numItems; i >= 0; i--)
        snapshot.snapshotItem(i).nodeValue = 'on';
}

// The password manager code checks for "autocomplete=off" in a callback
// from WebCore when the DOM content is loaded.  It doesn't seem to be
// documented, but this callback seems to happen after in-page event listeners
// fire, and before content scripts with "run_at" = "document_end" are loaded.
// Therefore, we load this script early and then run the actual transform code
// on an appropriate event listener.
window.addEventListener('DOMContentLoaded', enableAutocomplete, false);

The above documented code will enable you to use autocomplete as usual.

For more information, please refer to the documentation.

Community
  • 1
  • 1
Praveen Kumar Purushothaman
  • 154,660
  • 22
  • 177
  • 226
  • I tried with not working, Password & Forms I checked Enable Autofill -- Not working for me –  Dec 15 '15 at 10:26