[翻译]  Can I disallow web browser autocomplete?

[CHINESE]  我可以禁止网络浏览器自动填充吗?


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?

有谁知道如何禁用自动完成?

5 个解决方案

#1


33  

The proper way to disable autocomplete is like this:

禁用自动完成的正确方法如下:

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

or

要么

<form autocomplete="off" ... >

MSDN: autocomplete Property

MSDN:自动完成属性

Mozilla: How to Turn Off Form Autocompletion

Mozilla:如何关闭表单自动完成功能

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

适用的浏览器版本:Netscape 6.2(Mozilla 0.9.4)或更高版本。 IE 5或更高版本。 ...

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.

此表单属性不是任何Web标准的一部分,但最初是在Microsoft的Internet Explorer 5中引入的.Netscape在6.2版中引入了它 - 在以前的版本中,此属性被忽略。自动填充属性是在银行和发卡机构的支持下添加的 - 但从未遵循标准认证。

#2


18  

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

有自动完成属性。它目前是一个专有属性(由Microsoft引入,但在成为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.

有关某些背景信息和其他信息,请参阅使用XHTML的自动完成属性和Web文档。

#3


7  

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

您可以将autocomplete属性添加到输入元素,但请注意,它对于低于HTML 5的任何内容都是专有的:

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

#4


3  

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.

基本上没有,你不能。您可以设置各种不同的属性,从浏览器到浏览器(甚至浏览器版本到浏览器版本,感谢Microsoft),您可以使用javascript玩游戏,但最终无法保证字段不会意外或故意自动完成当前或未来版本的浏览器。如果您被告知实施此操作,最好的办法是应用一个或两个浏览器特定的修复程序,然后将这些特定版本列为推荐(或者如果您想要成为卑鄙和疏远客户,则需要)浏览器使用你的网站。

#5


1  

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

不要为INPUT标签使用通用名称/ ID?

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

GUIDs are pretty unique, right?

GUID非常独特,对吧?

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

That would be fun code to maintain!

这将是有趣的代码维护!


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2018 ITdaan.com 粤ICP备14056181号