Vij*_*der 15 html auto-populate struts1
在Chrome浏览器中,我保存了用户名和密码.
现在,如果我导航到其他形式并且它包含其他一些东西的用户名和密码,那么我保存的那个是自动填充的.
我怎么能阻止这个?
小智 18
什么时候autocomplete=off不能阻止填写凭据,请使用以下 -
修复浏览器自动填充:readonly并在焦点上设置writeble(单击和选项卡).
<input type="password" readonly onfocus="this.removeAttribute('readonly');" onblur="this.setAttribute('readonly','');"/>
Run Code Online (Sandbox Code Playgroud)
请参考以下内容:
https : //www.chromium.org/developers/design-documents/create-amazing-password-forms
和https://www.chromium.org/developers/design-documents/form-styles-那个铬理解
尝试以下操作:
<form id="login" action="signup.php" method="post">
<input type="text" autocomplete="username">
<input type="password" autocomplete="new-password">
<input type="password" autocomplete="new-password">
<input type="submit" value="Sign Up!">
</form>
Run Code Online (Sandbox Code Playgroud)
对于Fire fox浏览器使用此:
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" />
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" />
<input type="password" name="password" id="password" value="" />
Run Code Online (Sandbox Code Playgroud)
对于Chrome浏览器:使用 autocomplete="new-password"
简单:有一个名为的HTML5属性autocomplete.
只需将其设置为off.
<input autocomplete="off"/>
Run Code Online (Sandbox Code Playgroud)