How? Does it scrape the website for adjacent input tags, one with text and one with password? No matter which website I visit, it accurately prompts a dropdown (Touch ID on Safari) on the username field. How can I build something similar?
1 Answer
HTML for a name field maybe
<label for='idName' class="required">Your name</label>
<input type='text' name='inpName' id='idName' class='full_width'
maxlength='60' autocomplete='username' value=''>
It is the autocomplete
attribute that does the magic.
Some values are
- username
- current-password
- tel
You can use other attributes such as name
and id
as well.
-
I don't think so. Many sites that have password managers trigger don't use "autocomplete" - some of mine included.– SteveCommented Apr 7, 2023 at 23:06
-
@Steve, my experience is different. And I did say that you can use other attributes. Commented Apr 11, 2023 at 20:14
-
I don't understand why @RohitGupta gets downvoted because he is right. More info on how password managers like LastPass, 1Password etc detect and autofill input fields can be found here stackoverflow.com/questions/20954944/… and here hidde.blog/…– MauriceCommented Apr 13, 2023 at 2:31
-
@Maurice, I assume it was Steve, and it's his prerogative to downvote. Commented Apr 13, 2023 at 3:55
type
attribute, e.g.<input type="password">
, is the most important part. Check this MDN article.