Zack Peterson
Zack Peterson

Reputation: 57323

Can I disallow web browser autocomplete?

You know how browsers autocomplete text boxes? Apparently this confuses users. They see it as a short list with only limited options.

Does anyone know how to disable autocomplete?

Upvotes: 19

Views: 7641

Answers (5)

Orclev
Orclev

Reputation: 695

Essentially no, you can't. You can set various attributes that vary from browser to browser (or even browser version to browser version, thanks Microsoft), and you can play games with javascript, but ultimately there's no guarantee that a field won't be autocompleted either accidentally or intentionally in current or future versions of browsers. Your best bet if you're being told to implement this is to apply one or two of the browser specific fixes, and then list those particular versions as the recommended (or required if you want to be mean and alienate customers) browser to use with your site.

Upvotes: 3

Andrew Hare
Andrew Hare

Reputation: 351446

The proper way to disable autocomplete is like this:

<input type="text" name="foo" autocomplete="off"/>

or

<form autocomplete="off" ... >

MSDN: autocomplete Property

Mozilla: How to Turn Off Form Autocompletion

Applicable browser versions: Netscape 6.2 (Mozilla 0.9.4) or later. IE 5 or later. ...

This form attribute is not part of any web standards but was first introduced in Microsoft's Internet Explorer 5. Netscape introduced it in version 6.2 -- in prior versions, this attribute is ignored. The autocomplete attribute was added at the insistance of banks and card issuers -- but never followed through on to reach standards certification.

Upvotes: 35

Gumbo
Gumbo

Reputation: 655119

There is the attribute autocomplete. It's currently a proprietary attribute (introduced by Microsoft but on the way to be part of HTML 5:

<input type="text" id="year" name="year" autocomplete="off" ... />

For some background and additional information, see The autocomplete attribute and web documents using XHTML.

Upvotes: 18

John Topley
John Topley

Reputation: 115292

You can add the autocomplete attribute to input elements, but be aware that it's proprietary for anything less than HTML 5:

<input type="text" id="year" name="year" autocomplete="off" />

Upvotes: 7

Zack Peterson
Zack Peterson

Reputation: 57323

Don't use common names/ids for INPUT tags?

<input type="text" id="year" name="year" ... />

GUIDs are pretty unique, right?

<input type="text" id="1b3d0ea8-3562-4937-a3d3-c91041a17c8b" ... />

That would be fun code to maintain!

Upvotes: 1

Related Questions