Html iPhone 浏览器的密码字段首字母默认为大写

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6356074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 09:07:15  来源:igfitidea点击:

iPhone browser defaulting to uppercase for first letter of password fields

iphonehtmluser-interfacesafari

提问by RSH1

I'm writing a login page for a mobile version of my webapp and I have a simple HTML password field like so:

我正在为我的 webapp 的移动版本编写登录页面,我有一个简单的 HTML 密码字段,如下所示:

<input id="password" type="password" />

The only problem is that the iPhone Safari browser capitalizes the first letter of the input by default, which is confusing my users as the password is case sensitive and they do not always realise this is the case.

唯一的问题是 iPhone Safari 浏览器默认将输入的第一个字母大写,这让我的用户感到困惑,因为密码区分大小写,他们并不总是意识到这种情况。

Does anyone know of a method, tag or otherwise to stop this happening and force the iPhone input to lowercase unless the user specifies otherwise? Or is this simply a feature of the platform that can't be changed?

有没有人知道一种方法、标签或其他方式来阻止这种情况发生并强制 iPhone 输入小写,除非用户另有指定?或者这只是平台无法更改的功能?

回答by Gerben

<input type="text" name="test1" autocapitalize="none"/>

The docs can be found here: Supported Attributes: autocapitalize

文档可以在这里找到:支持的属性:autocapitalize

回答by digidigo

You may want to turn off both autocorrect and autocapitalize for password and email fields.

您可能需要关闭密码和电子邮件字段的自动更正和自动大写。

Here are what mine look like:

这是我的样子:

<input autocapitalize="off" autocorrect="off" id="email" name="email" type="text">
<input autocapitalize="off" autocorrect="off" id="password" name="password" type="password">