Preventing Browser Text Input Suggestions 2021 chrome version 88.0.4324.190 - html

How To Preventing Browser Text Input Suggestions from browser cookie, autocomplete="off" and others are not work.. Chrome Version : 2021 chrome version 88.0.4324.190
readonly is work for autofill its work proper, but autosuggestion is not.
<input type="email" class="form-control" id="email" name="email" placeholder="Enter Email" readonly onfocus="this.removeAttribute('readonly');" style="background-color: white;" autocomplete="off">
<input type="password" class="form-control" id="Password" name="password" minlength="6" placeholder="Enter Password">

what you want is here
change type="password" to type="text" and used in your input
-webkit-text-security: disc !important;
<input type="text" class="form-control" id="Password" name="password" minlength="6" placeholder="Enter Password" style="-webkit-text-security: disc !important;">

The only thing that still works in Chrome is creating random name not related to the field. Like autocomplete="new-password" to password field name.
Seems to be wrong, but it's a workaround.
So for your field named email, try to put autocomplete="new-email".
Even as stated as working in the SO below, autocomplete="off" still buggy:
Disabling Chrome Autofill
Also note that autocomplete="no" will appear to work but autocomplete="off" will not for historical reasons. autocomplete="no" is you telling the browser that this field should be auto completed as a field called "no". If you generate unique random autocomplete names you disable auto complete.
You need to keep in mind that's a feature from the Password Manager.
This is correctly stated here by Mozilla:
Preventing autofilling with autocomplete="new-password"
And why it's not always possible to prevent:
Browser compatibility
Note: In most modern browsers, setting autocomplete to "off" will not prevent a password manager from asking the user if they would like to save username and password information, or from automatically filling in those values in a site's login form. See the autocomplete attribute and login fields.
Solution #1:
As you can see, the autosuggestion show From this website.
As workaround, you need to change the fieldname from name="email" to something else, like name="user-email".
And handle the change inside your server logic.
Again in your server logic, generate a random name every time page is shown, like a UUID autocomplete="c821c4f0-7be8-11eb-9439-0242ac130002"
Solution #2:
Replace the input kind type="email" to type="text".
html:
<input type="text" class="form-control" id="user-email" name="user-email" placeholder="Enter Email" readonly onfocus="this.removeAttribute('readonly');" autocomplete="off" />
javascript:
window.onload = function () {
init();
}
function init() {
let x = document.getElementById("user-email");
if (x) x.setAttribute("type", "email");
}
Solution #3:
Add hidden fields before the real one:
HTML - Disable Password Manager
PS: Don't forget to place autocomplete="off" on the form which field belongs

Related

Disable Password List suggestion pick in chrome

In html code i have try to use this:
<input type="password" name="password" autocomplete="new-password">
<input type="password" name="password" autocomplete="new">
<input type="password" name="password" autocomplete="off">
<input type="password" name="password" autocomplete="nope">
Update test diferent name tag:
<input type="password" name="p1" autocomplete="nope">
<input type="password" name="p2" autocomplete="nope">
<input type="password" name="ahgsfkhas" autocomplete="nope">
To prevent chrome to show suggestion picker List, but none of this work, this is the result:
some way to disable this through an HTML or JQuery / javascript tag, I don't have access to all Chrome installations on PCs, like to edit this feature
this is not an offer to save password; this is a select picker from password stored (Password Manager). this breaks into the Interface of a Web Page, and I see no way to deactivate it from the web page, since I don't have access to the browser settings.
I had the same problem it seems difficult to solve I found a solution
To solve the problem the input in initialization must be equal to type="text" and then change to type="password" with the first focus or insert input
function changeTypeInput(inputElement){
inputElement.type="password"
}
<input type="text"
id="anyUniqueId"
onfocus="changeTypeInput(this)"
oninput="changeTypeInput(this)"
/>
it's relative to the browser
settings => automatic entry => password => Offer to save passwords (no)

How can I stop Safari autofilling the email field with the wrong email?

Our contact-management software enables users to add contact details for their friends to their account.
One of the details you can add is "email address". However for some reason on Safari the email address field gets autofilled with the user's own email address that they use to log in. It doesn't happen if you turn off the "autofill" option under "preferences", but that's obviously not a workable solution for all our users.
I've tried adding autocomplete="off" but it seems that this is just ignored by Safari.
Here are the two fields:
Login Field:
<input type="email" class="input-block-level" placeholder="Email address" name="email" id="user_email">
Internal Field:
<input type="text" id="pri_email" autocomplete="off" name="pri_email">
What I can't understand is why Safari even thinks they are the same thing. They have different ids and names.
How can I stop this from happening? Preferably without hacky work-arounds like the ones suggested here.
Set AUTOCOMPLETE = off in the form tag.
<FORM METHOD="POST" ACTION="" AUTOCOMPLETE="off">
Check this one - Change the type for text to email
<input type="email" id="pri_email" autocomplete="off" name="pri_email">
Use in the tag form autocomplete=”off”
and still if not works it is because autocomplete=”off” is not valid markup with XHTML Transitional, that is common DOC TYPE. Use this to keep a valid markups try this.
if (document.getElementsByTagName) {
var inputElements = document.getElementsByTagName(“input”);
for (i=0; inputElements[i]; i++) {
if (inputElements[i].className && (inputElements[i].className.indexOf(“disableAutoComplete”) != -1)) {
inputElements[i].setAttribute(“autocomplete”,”off”);
}
}
}
Apparently, the state off / on is still not correctly implemented in all browsers.
However, for most browsers, an "invalid" value seems to produce the desired effect of "off".
Try this:
<input type="text" id="pri_email" autocomplete="nope" name="pri_email">
it works with fake input:
<input autocomplete="off" type="text" name="email">
<input type="text" name="fake_email" id="fake_email" style="height: 0px; width: 0px; overflow: hidden;" tab-index="-1" aria-hidden="true">
autofill single field email in Safari (ios) does not working
Luckily there is an "easy" solution.
Inserting text with the word “search” into the name attribute will prevent Safari from showing the AutoFill icon and keyboard option. This works because Safari performs a regex and maps “search” to an input that does not require the AutoFill.
<input name=”notASearchField” />
Source: https://bytes.grubhub.com/disabling-safari-autofill-for-a-single-line-address-input-b83137b5b1c7
you can use
<input type="email" class="input-block-level" placeholder="Email address" name="email" id="user_email" value="">
The reason is that safari ignores autocomplete. It will accept it if the version of Safari is 5.2 or higher. It is mentioned on w3schools.com

How to turn off HTML input form field suggestions?

By suggestions, I mean the drop down menu appear when you start typing, and it's suggestions are based on what you've typed before:
For example, when I type 'a' in title field, it will give me a ton of suggestions which is pretty annoying.
How can this be turned off?
What you want is to disable HTML autocomplete Attribute.
Setting autocomplete="off" here has two effects:
It stops the browser from saving field data for later autocompletion
on similar forms though heuristics that vary by browser. It stops the
browser from caching form data in session history. When form data is
cached in session history, the information filled in by the user will
be visible after the user has submitted the form and clicked on the
Back button to go back to the original form page.
Read more on MDN Network
Here's an example how to do it.
<form action="#" autocomplete="on">
First name:<input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
E-mail: <input type="email" name="email" autocomplete="off"><br>
<input type="submit">
</form>
If it's on React framework then use as follows:
<input
id={field.name}
className="form-control"
type="text"
placeholder={field.name}
autoComplete="off"
{...fields}/>
Link to react docs
Update
Here's an update to fix some browsers skipping "autocomplete=off" flag.
<form action="#" autocomplete="off">
First name: <input type="text" name="fname" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"><br> Last name: <input type="text" name="lname" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"><br> E-mail:
<input type="email" name="email" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"><br>
<input type="submit">
</form>
On Chrome, the only method we could identify which prevented all form fills was to use autocomplete="new-password". Apply this on any input which shouldn't have autocomplete, and it'll be enforced (even if the field has nothing to do with passwords, e.g. SomeStateId filling with state form values). See this link on the Chromium bugs discussion for more detail.
Note that this only consistently works on Chromium-based browsers and Safari - Firefox doesn't have special handlers for this new-password (see this discussion for some detail).
Update: Firefox is coming aboard! Nightly v68.0a1 and Beta v67.0b5 (3/27/2019) feature support for the new-password autocomplete attribute, stable releases should be coming on 5/14/2019 per the roadmap.
Update in 2022: For input fields with a type of password, some browsers are now offering to generate secure passwords if you've specified autocomplete="new-password". There's currently no workaround if you want to suppress that behavior, but I'll update if one becomes available.
use autocomplete="off" attribute
Quote:IMPORTANT
Put the attribute on the <input> element,
NOT on the <form> element
Adding the two following attributes turn off all the field suggestions (tested on Chrome v85, Firefox v80 and Edge v44):
<input type="search" autocomplete="off">
I know it's been a while but if someone is looking for the answer this might help. I have used autocomplete="new-password" for the password field. and it solved my problem. Here is the MDN documentation.
This solution worked for me: Add readonly attribute.
Here's an update to fix some browsers skipping the
"autocomplete=off" flag.
<input type="text" name="lname" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');">
autocomplete = "new-password" does not work for me.
I built a React Form.
Google Chrome will autocomplete the form input based on the name attribute.
<input
className="scp-remark"
type="text"
name="remark"
id='remark'
value={this.state.remark}
placeholder="Remark"
onChange={this.handleChange}
/>
It will base on the "name" attribute to decide whether to autofill your form. In this example, name: "remark". So Chrome will autofill based on all my previous "remark" inputs.
<input
className="scp-remark"
type="text"
name={uuid()} //disable Chrome autofill
id='remark'
value={this.state.remark}
placeholder="Remark"
onChange={this.handleChange}
/>
So, to hack this, I give name a random value using uuid() library.
import uuid from 'react-uuid';
Now, the autocomplete dropdown list will not happen.
I use the id attribute to identify the form input instead of name in the handleChange event handler
handleChange = (event) => {
const {id, value} = event.target;
this.setState({
[id]: value,
})
}
And it works for me.
I had similar issue but I eventually end up doing
<input id="inp1" autocomplete="off" maxlength="1" />
i.e.,
autocomplete = 'off' and suggestions will be disappeared.
<input type="text" autocomplete="off"> is in fact the right answer, though for me it wasn't immediately clear.
According to MDN:
If a browser keeps on making suggestions even after setting
autocomplete to off, then you have to change the name attribute of the
input element.
The attribute does prevent the future saving of data but it does not necessarily clear existing saved data. Thus, if suggestions are still being made even after setting the attribute to "off", either:
rename the input
clear existing data entries
Additionally, if you are working in a React context the attribute naturally becomes autoComplete.
Cheers!
I ended up changing the input field to
<textarea style="resize:none;"></textarea>
You'll never get autocomplete for textareas.
If you are using ReactJS. Then make this as autoComplete="off"
<input type="text" autoComplete="off" />

Remove Chrome autofill for HTML forms

I have created a simple form in HTML which has two fields: Username and Password, and then a Log in button.
When I run the page in Chrome it fills the two fields with my XAMPP-phpmyadmin username and password into the fields and highlights them yellow.
How can I completely remove this so they are blank. Thanks
HTML form code:
<html>
<form action= "entryformlogon.php" method = "post" autocomplete="off">
Username: <input type="text" name="Username"><br>
Password: <input type="password" name="Password"><br>
<input type="submit" value="Log in">
</form>
</html>
autocomplete= "off" must be added to every input element. i.e.
<input type="text" name="Username" autocomplete="off">
Chrome it fills the two fields with my XAMPP-phpmyadmin username and password into the fields and highlights them yellow. How can I completely remove this so they are blank. #Charley Baker
This readonly-fix worked for me:
fix browser autofill in: readonly and set writeble on focus (at mouse click and tabbing through fields)
<input type="password" readonly
onfocus="$(this).removeAttr('readonly');"/>
By the way, some more information on Chrome and Safari auto fill behaviour:
Sometimes even autocomplete=off would not prevent to fill in credentials into wrong fields, but not user or nickname field. I guess, the Chrome and Safari look for a password field to insert your saved credentials. Then it autofills username into the nearest textlike-input field , that appears prior the password field in DOM (just guessing due to observation). As the browser is the last instance and you can not directly control it, but the read-only trick above fixes it. :-)
For latest version of chrome
<input type="password" name="whatever" autocomplete="new-password" />
older version
<input type="password" name="whatever" autocomplete="false" />
or
<input type="password" name="whatever" autocomplete="off" />

Stop Google chrome auto fill the input [duplicate]

This question already has answers here:
Disabling Chrome Autofill
(68 answers)
Closed 5 years ago.
I have a input type text for user to change their email & password in account setting page.
How can stop Chrome auto fill the input.
Chrome remember the input data from log in page and it auto fill in account setting page.
Chrome auto fill the input change my email & password in account setting page
We are no longer dependent on hacks for this. You can set autocomplete to new-password and it will work as intended.
<input type="password" name="pwd" autocomplete="new-password">
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete
Are you explicitly setting the values as blank? For example:
<input type="text" name="textfield" value="">
That should stop browsers putting data in where it shouldn't. Alternatively, you can add the autocomplete attribute to the form tag:
<form autocomplete="off" ...></form>
Solution 1:
Putting 2 lines of code under under <form ..> tag does the trick.
<form id="form1" runat="server" >
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
...
Read more
Solution 2: It removes "name" and "id" attributes from elements and assigns them back after 1ms. Put this in document get ready.
$('form[autocomplete="off"] input, input[autocomplete="off"]').each(function () {
var input = this;
var name = $(input).attr('name');
var id = $(input).attr('id');
$(input).removeAttr('name');
$(input).removeAttr('id');
setTimeout(function () {
$(input).attr('name', name);
$(input).attr('id', id);
}, 1);
});
Solution 3: Tested in Chrome 60.0.3112.101
<input type="password" name="pwd" autocomplete="new-password">
This issue still exists as of Version 55.0.2883.87 m. (on Windows 10)
Solutions like setting the autocomplete attribute on a form
or adding fake input fields and removing the name attribute before submit do not work anymore, since Chrome ignores or instantly auto-completes them on removal.
The only way to get it currently to work as intended is to set the autocomplete attribute to "new-password"
<input type="text" name="text" autocomplete="new-password">
even on non password type inputs.
The latest version of Chrome (46.0.2490.86) appears to have changed behaviour again. This time, AutoFill has nothing to do with autocomplete or readonly or other workarounds suggested here (and on these bug reports https://code.google.com/p/chromium/issues/detail?id=468153, https://bugs.chromium.org/p/chromium/issues/detail?id=587466)
Rather, AutoFill now looks at the label next to the input box and generates an AutoFill based on that (as well as the id and name). A big clue is how AutoFill can actually fill multiple fields at once (e.g. Street, Suburb and State). It appears to be using several techniques (label, name, id) to discern the spatial relationship between fields.
So a workaround is to insert junk text into the label inside a hidden span...
S<span style="display:none">_</span>uburb:
...and also obfuscate/remove the id and name. This was the only thing that prevented Suburb AutoFill for me.
Unfortunately autocomplete="off" didn't work for me (anymore). So here is my solution:
First read and then remove "name" and "id" attributes from elements. Then, after 1ms, set these attributes back again with values read before. For me it works :)
<form autocomplete="off"><br />
<input type="text" name="username" id="username" /><br />
<input type="password" name="password" id="password" /><br />
</form>
<pre>
$('form[autocomplete="off"] input, input[autocomplete="off"]').each(function(){
var input = this;
var name = $(input).attr('name');
var id = $(input).attr('id');
$(input).removeAttr('name');
$(input).removeAttr('id');
setTimeout(function(){
$(input).attr('name', name);
$(input).attr('id', id);
}, 1);
});
</pre>
By setting autocomplete="new-password" , it works.
Before testing, you clear browsing data first
Almost jumped out the window trying to solve this... seems Google now ignores Autocomplete ON and OFF. I had used on older fix (such as fake hidden password fields - which also no longer worked). Based on the living standard spec - you need to use an auto-fill tokens instead. You must use them in the appropriate use-case context. Hope this is helpful.
https://html.spec.whatwg.org/multipage/forms.html#autofilling-form-controls:-the-autocomplete-attribute
Chrome ignores both autocomplete="anything" and hidden fields. A HTML/CSS workaround would be using an absolute positioned password field before the real one:
<input type="text" name="username" required>
<input style="visibility: hidden; position: absolute; left:-99999px" type="password" name="fakepasswordfieldtoturnoffautocomplete">
<input type="password" name="password" required>
EDIT:
As referred in multiple other answers in other duplicate questions, the most elegant working solution so far is this:
<input type="password" readonly onfocus="this.removeAttribute('readonly');"/>
Try hidden password element
<form>
<input type="text" name="fakeusername" class="fake-autofill-fields"/>
<input type="password" name="fakepassword" class="fake-autofill-fields"/>
...
...
</form>
<script>
$(document).ready(function () {
$(".fake-autofill-fields").show();
window.setTimeout(function () {
$(".fake-autofill-fields").hide();
}, 1);
});
</script>
Enter a value of ' ' (a blank space) for the username field and Chrome doesn't autopopulate username or password.
<input type = 'text' value = ' ' name = 'username' />
If you're ever populating the username with a user-entered value, code to enter a ' ' if there's no user-entered value.
Try this:
<div id="form_container">
<input type="text" name="username" autocomplete="off">
<input type="password" name="pwd" autocomplete="off">
<input tytep="submit" name="login" id="login" value="Log In">
</div>`
The jquery code:
jQuery("#login").click(function(){
jQuery("#form_container").wrap('<form method="post"></form>');
jQuery("form").submit();
});
If you don't wrap your input fields into a form, then the chrome's autofill won't come up.
When you click on the submit button, just frap the fields around the form and fire a submit() on the form.
I had a similar problem. After all of the attempts failed. I tried this hack of setting
type = "search"
instead of text. Even though its not a pretty hack. It does not cause any issues in majority of cases. type search is no different than text as of now.
This works:
<form autocomplete="off" ...></form>
Tested on Chrome 56.0.2924.87 (64-bit)