In the Chrome browser, I have saved the username and the password.
Now, if I navigate to some other form and it contains the username and password for some other stuff, the one I saved is auto-populated here.
How can I stop this?
In the Chrome browser, I have saved the username and the password.
Now, if I navigate to some other form and it contains the username and password for some other stuff, the one I saved is auto-populated here.
How can I stop this?
When autocomplete=off
would not prevent to fill in credentials, use following -
fix browser autofill in: readonly and set writeble on focus (click and tab).
<input type="password" readonly onfocus="this.removeAttribute('readonly');" onblur="this.setAttribute('readonly','');"/>
For Fire fox browser use this:
<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="" />
For Chrome browser:
use autocomplete="new-password"
Please refer to the following:
https://www.chromium.org/developers/design-documents/create-amazing-password-forms
and https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands
Try the following :
<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>
Simple: there's an HTML5 attribute called autocomplete
.
Just set it to off
.
<input autocomplete="off"/>
autocomplete="off"
. The readonly
answer from AK Square Infomedia does work for those cases. Great for update profile forms where you usually only want the password sent through if it's changing. –
Arezzini <textarea required="required" autocorrect="off" autocapitalize="off" name="username" class="form-control" placeholder="Your username" rows="1" cols="20" wrap="off"></textarea>
<textarea required="required" autocorrect="off" autocapitalize="off" name="password" class="form-control password" placeholder="Your password" rows="1" cols="20" wrap="off"></textarea>
@font-face {
font-family: 'password';
src: url('css/font/password.woff2') format('woff2'),
url('css/font/password.woff') format('woff'),
url('css/font/password.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
textarea.form-control {
overflow:hidden;
resize:none;
height:34px;
}
textarea.form-control.password:valid {
font-family: 'password';
}
Notes
In the end, it end up been a freaking webshit sum of hacks (but it works)
First try to set the password field as
autocomplete="new-password"
The above solution should stop auto filling of both username & password
Note: Sometime setting up autocomplete="off" on username & password may not work
© 2022 - 2024 — McMap. All rights reserved.