【发布时间】:2015-11-25 22:03:07
【问题描述】:
我有一个编辑用户表单:
<form method="post" action="index.php" />
Email:
<input type="text" name="email" value="user@domain.com" />
Password:
<input type="password" name="password" value="thesavedpassword" />
</form>
Safari 会为我覆盖我预先填写的用户名和密码,因此我添加了所有自动完成选项 - 这不起作用。
继续阅读,我听说 readonly 对某些人有效,所以我也尝试过,但仍然无效。以下是包含所有内容的代码:
<form method="post" action="index.php" autocomplete="off" />
Email:
<input type="text" name="email" value="user@domain.com"
autocomplete="off" readonly onfocus="this.removeAttribute('readonly');" />
Password:
<input type="password" name="password" value="thesavedpassword"
readonly autocomplete="off" onfocus="this.removeAttribute('readonly');" />
</form>
我真的不知道从这里去哪里!为什么 Safari 会覆盖已经填写的字段?
提前非常感谢!
【问题讨论】:
标签: html autocomplete safari passwords autofill