Is there a standard way to prevent native autocompletion?
I'd like to prevent my back-office login form to display the auto-completion usually displayed with Firefox for instance. I quickly read some stuff about the attribute autocomplete
but it doesn't seem to开发者_如何学编程 be standard.
Must I use write some JavaScript to achieve this?
No JavaScript required. You are right, the autocomplete attribute is not part of the standard, but neither is the autocomplete feature itself. :)
EDIT:
Straight from Mozilla:
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.
Setting autocomplete="off"
is not standard, but will work in any modern browser.
<form action="..." method="post" autocomplete="off">
...
</form>
精彩评论