简体   繁体   English

如何确保自动完成适用于特定字段?

[英]How do I ensure autocomplete works for a specific field?

How do browsers recognize if a particular field (like a username) should be prompted with autocompletes? 浏览器如何识别是否应该使用自动填充提示特定字段(如用户名)? Do they use some sort of regex to match the fields name attribute? 他们是否使用某种正则表达式来匹配字段name属性? Is there a standard I need to follow to ensure this? 是否有标准我需要遵循以确保这一点?

I ask this because on some sites the browser fails to suggest any historical data. 我问这个是因为在某些网站上浏览器无法提供任何历史数据。

Put simply, I am asking the exact opposite of what this person was trying to achieve: 简而言之,我问这个人想要达到的目的正好相反

How do you disable browser Autocomplete on web form field / input tag? 如何在Web表单字段/输入标记上禁用浏览器自动完成?

With HTML5: 使用HTML5:

 <form action="demo_form.asp" method="get" autocomplete="on">
 First name:<input type="text" name="fname" /><br />
 E-mail: <input type="email" name="email" /><br />
 <input type="submit" />
 </form>

Source: http://www.w3schools.com/html5/att_form_autocomplete.asp 资料来源: http//www.w3schools.com/html5/att_form_autocomplete.asp

In my experience it's based on matching the name or id attribute of the input tag. 根据我的经验,它基于匹配输入标记的name或id属性。 Which is why you generally find that username, email and name fields tend to autocomplete on a number of different websites. 这就是为什么您通常会发现用户名,电子邮件和名称字段倾向于在许多不同的网站上自动完成。

I think the matching has to be exact, not a regex or partial match on the field. 我认为匹配必须准确,而不是场上的正则表达式或部分匹配。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何确保“选择”输入的格式在Mac OS上有效 - How do I ensure the formatting for the `select` input works on Mac OS 如何在 html 中获取输入字段以确保模式包含特定国家/地区代码,例如 1472,后跟 3 个数字,然后是 4 个数字 - how do I get an input field in html to ensure the pattern contains a specific country code eg 1472 followed by 3 number and then 4 numbers 如何确保我的网站或基于HTML的网络应用程序能够在所有浏览器上正常运行 - How do I ensure my website or web app based on html works on all browsers properly 如何确保 Google 密码管理器将正确的字段存储为用户名? - How do I ensure Google Password Manager stores the correct field as the username? 如何确保图像和文本具有响应性? - How do I ensure that the images and text are responsive? 如何避免浏览器列出关于输入字段的建议(不一定与禁用自动完成/自动填充相同)? - How do I keep browser from listing suggestions for input-field (not necessarily the same as disabling autocomplete/autofill)? 如何停止自动完成对特定表单字段的处理 - how to stop autocomplete from working on a specific form field 我如何确保访问过的链接在反应时不会变成紫色? - How do I ensure visited links do not go purple on react? 如何重置输入自动完成样式? - How do I reset input autocomplete styles? 如何在自动完成中用空格替换下划线? - How do I replace underscores with spaces in autocomplete?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM