HTML forms - enabling browers to ask for remembering the value of a text form?
-
12-11-2019 - |
Pregunta
I have a field that I've labeled 'password', and I'd like the browser to ask the user whether they want to store that password. How do I do this? Is there an HTML attribute to use?
For instance the HTML for the form would be:
<form action="" method="POST" name="form">
Enter password:
<input type="text" name="password" /><br />
A checkbox
<input type="checkbox" name="some_checkbox" value="Yes" /><br />
A textarea<br />
<textarea name="input_text" cols=40 rows=10></textarea><br />
<input type=submit value="Submit">
And I'd like the browser to prompt for storing the 'password' input.
Solución
This should do it:
<input type="password" name="password" />
Note the proper type
for the password box.
Otros consejos
You can't explicitly force the browser to show that dialog, but using the correct elements gives the browser a helping hint.
So make sure your password element has the type="password"
attribute.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow