Html 个人数据使用的表单字段名称在浏览器(Safari、Opera)中自动填充

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1027462/
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-28 23:57:55  来源:igfitidea点击:

Form field names used by personal data auto-fill in browsers (Safari, Opera)

htmlformsautofill

提问by Kornel

I'm looking for complete list of form field names (<input name="…">) that are recognized by auto-fill functions in major browsers.

我正在寻找<input name="…">可被主要浏览器中的自动填充功能识别的表单字段名称 ( ) 的完整列表。

Here are some I've found to work in Safari using trial-and-error:

以下是我通过反复试验发现可以在 Safari 中使用的一些方法:

  • email
  • Ecom_ReceiptTo_Postal_Name_First
  • Ecom_ReceiptTo_Postal_Name_Last
  • first-name
  • firstname
  • last-name
  • lastname
  • full-name
  • birthday
  • company
  • jobtitle
  • phone
  • street
  • city
  • country
  • state(used for county outside US)
  • postalcode
  • zip
  • email
  • Ecom_ReceiptTo_Postal_Name_First
  • Ecom_ReceiptTo_Postal_Name_Last
  • first-name
  • firstname
  • last-name
  • lastname
  • full-name
  • birthday
  • company
  • jobtitle
  • phone
  • street
  • city
  • country
  • state(用于美国以外的县)
  • postalcode
  • zip

However I couldn't find separate field for title/honorific prefix (it's included in full name only).

但是我找不到标题/敬语前缀的单独字段(它仅包含在全名中)。

Opera's Wand recognizes more or less the same names with exception of name, which requires Ecom_ReceiptTo_Postal_Name_Firstand Ecom_ReceiptTo_Postal_Name_Last.

Opera's Wand 可以识别或多或少相同的名称,但名称除外,它需要Ecom_ReceiptTo_Postal_Name_FirstEcom_ReceiptTo_Postal_Name_Last

I couldn't find field for mobile phone number. Haven't found way to get separate home/work fields.

我找不到手机号码字段。还没有找到获得单独的家庭/工作领域的方法。



There's proposal to extend autocompleteattributeto allow developers specify these explicitly.

有提议扩展autocomplete属性以允许开发人员明确指定这些。

采纳答案by max

I wasn't aware of the names you used. But I knew Mozilla/Netscape and IE use vcard_name attributes to guide autofill as described here.

我不知道你使用的名字。但我知道 Mozilla/Netscape 和 IE 使用 vcard_name 属性来指导自动填充,如此处所述

回答by Fran?ois

According to http://www.macosxhints.com/article.php?story=20070527063904285the file Contents/Resources/English.lproj/ABAutoCompleteMappings.plist within the Safari.app package leads this list:

根据http://www.macosxhints.com/article.php?story=20070527063904285Safari.app 包中的文件 Contents/Resources/English.lproj/ABAutoCompleteMappings.plist 导致此列表:

first
first name
fname
firstname
given name

middle initial
middleinitial
middle name
middlename
middle

last
last name
lname
lastname
surname

name

birthday
date of birth
born

job title
jobtitle

email
e-mail

street
street address
streetaddress
address1
address 1

address

city

state

zip
zipcode
zip code
postalcode
postal code

country

homephone
home phone
eveningphone
evening phone
home area code
home areacode
homeareacode
evening area code
evening areacode
eveningareacode

workphone
work phone
dayphone
day phone
daytime phone
companyphone
company phone
businessphone
business phone
work area code
work areacode
workareacode
day area code
day areacode
dayareacode
company area code
company areacode
companyareacode
business area code
business areacode
businessareacode

mobilephone
mobile phone
cellphone
cell phone
mobile area code
mobile areacode
mobileareacode
cell area code
cell areacode
cellareacode

pagerphone
pager phone
pager area code
pager areacode
pagerareacode

area code
areacode

phone

fax

organization
company

回答by Colin Pickard

There is a RFCfor this. But apparently some implementationssearch for labels rather than using field names.

对此有一个 RFC。但显然有些实现会搜索标签而不是使用字段名称。

Did you try Ecom_ShipTo_Postal_Name_Prefix, Ecom_BillTo_Postal_Name_Prefixor Ecom_ReceiptTo_Postal_Name_Prefixfor the title?

你试过Ecom_ShipTo_Postal_Name_PrefixEcom_BillTo_Postal_Name_Prefix还是Ecom_ReceiptTo_Postal_Name_Prefix为了标题?

There doesn't seem to be any option for multiple phone numbers described in the RFC. Just Ecom_ReceiptTo_Telecom_Phone_Numberetc

RFC 中描述的多个电话号码似乎没有任何选项。只是Ecom_ReceiptTo_Telecom_Phone_Number

回答by Dan F

This might be a silly suggestion*, but have you considered getting the source and poking around? Webkit is here, Firefox is here(kinda). It won't help with Opera or IE though.

这可能是一个愚蠢的建议*,但是您是否考虑过获取源代码并四处查看?Webkit 来了Firefox 来了(有点)。但它对 Opera 或 IE 没有帮助。

*It'd be silly for me, c/c++ is all double duch to me :-)

*这对我来说很愚蠢,c/c++ 对我来说都是双重的 :-)