Reputation: 12138
I've just been given a requirement to prevent browsers from saving data entered into specific form fields. It's been years since I've done web dev, and this is a relatively new capability. I was able to find the form field property autocomplete="off", but I can't seem to find any documentation indicating which browsers support it. Can anyone point me in the right direction of a chart of form attributes and browser compatibility?
Upvotes: 86
Views: 96771
Reputation: 1844
td;dr: To check on compatibility across browsers, here is an official MDN doc on turning off autocompletion with the link for compatibility - https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
A little longer answer: Your issue is because of Chrome's autofill feature, and here is Chrome's stance on it in this bug link - https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164
To put it simply, there are two cases -
[CASE 1]: Your input
type is something other than password
. In this case, the solution is simple, and has three steps.
name
attribute to input
name
should not start with a value like email or username, otherwise Chrome still ends up showing the dropdown. For example, name="emailToDelete"
shows the dropdown, but name="to-delete-email"
doesn't. Same applies for autocomplete
attribute.autocomplete
attribute, and add a value which is meaningful for you, like new-field-name
It will look like this, and you won't see the autofill (and the value you enter won't be cached) for this input again for the rest of your life -
<input type="text/number/something-other-than-password" name="x-field-1" autocomplete="new-field-1" />
[CASE 2]: input
type
is password
Upvotes: 0
Reputation: 519
Matter of fact, both username and password fields doesn't react to AutoComplete=off in all the latest browsers.
Upvotes: 1
Reputation: 1641
Some solution is not working in modern browsers.
Another solution link is given here. which works in all modern browsers.
Input type=password, don't let browser remember the password
You can use autocomplete="off" in this given soluton
Upvotes: 1
Reputation: 11
Except for Maxthon Browser I think, they are famous in china and making a name now worldwide. They don't treat Autotocomplete=off power very well. It won't work with them.
Upvotes: 1
Reputation: 253486
Be aware that all major browsers are moving towards ignoring the attribute for password fields.
I can only offer anecdotal evidence, but I've yet to come across a browser that fails to respect autocomplete="off"
, this experience covers:
I'm aware that Greasemonkey scripts, and presumably other user-scripts, can disable the autocomplete
setting.
There's a couple of articles I found that might be useful to you:
Upvotes: 103
Reputation: 16198
Password managers now ignore the autocomplete
attribute for password
fields in the major browsers as of:
It should still work fine for disabling autocomplete
on form fields, but no longer affects the password manager.
Upvotes: 37
Reputation: 1002
As of Chrome v34, autocomplete="off"
is now ignored by default.
This somewhat debatable feature can be disabled in the flags configuration by visiting chrome://flags
http://news.softpedia.com/news/Chrome-34-Seeks-to-Save-All-Your-Passwords-436693.shtml
Upvotes: 6
Reputation: 11215
If you're able to use JavaScript and jQuery, you can place this on load of the html:
$('#theform input').val('');
Upvotes: 4