17

Chrome was recently updated with an annoying popup that comes down from an icon in the address bar and prompts to save a password on the page when the user submits the form. There's no other input box on this page, and no other browser prompts to save this password, so I don't know why Chrome does. It is a password, therefore it shouldn't be visible as plain text in the input box, but it's not a password that should ever be saved - it's not login credentials. It's actually quite important the user of the computer does not know this password - someone else must enter it in for them - so if the browser saves it that would be bad.

How can you prevent Chrome (and all browsers) from prompting to save this password?

<form action="/..." method="post" onsubmit="return pwFormIsSubmittable();"> <p>Password: <input autofocus="" type="password" name="1409_password" style="width:100px" tabindex="1" autocomplete="off"></p> <div class="tabSubmitButtons"> <input type="button" name="event=default" value="Cancel" onclick="window.location='...'" tabindex="3">"); <input type="submit" value="Submit" onclick="submitForm();" tabindex="2"> <input type="hidden" name="begin" value="Yes"> <!-- couple other hidden inputs --> </div> </form> 

annoying chrome popup

2
  • 1
    Do not send the form directly, prevent the submit and use an AJAX request, or change the type of the input from "password" to "hidden" could work. Commented Dec 3, 2014 at 20:00
  • stackoverflow.com/questions/30028615/… Commented Jan 5, 2016 at 16:01

10 Answers 10

24

Instead of using input type password, use type text with style set to style="-webkit-text-security: disc;" which will replace the characters with dots.

<input type="text" id="password" style="-webkit-text-security: disc;"> 

There are other options to using the dot:

input { -webkit-text-security: none; } input { -webkit-text-security: circle; } input { -webkit-text-security: square; } input { -webkit-text-security: disc; /* Default */ } 

Answer found here: how to disable save password prompt in chrome

Sign up to request clarification or add additional context in comments.

1 Comment

Word to the wise: --webkit-* styles are available in Safari and chromium browsers (Chrome, Brave, Opera, Edge, etc.). This answer won't work for IE, FF, or other browsers that don't use Webkit or Blink engines. More info: stackoverflow.com/questions/3468154/…
11

One solution or workaround is to add <input type="password" style="display:none"/> above the real password input box. Chrome only tries to save the first password it finds and if it's blank it won't throw up the dialog to save it.

3 Comments

This didn't work for me. But setting content to empty string before JS redirect worked. Of course if it's a form submit you can't do that
It didn't work for me too.
It works if it's not "display: none", it should be hidden in another way like "position: fixed; right: -200%; bottom: -200%;"
8

The reason browsers are ignoring autocomplete=off is because there have been some web-sites that tried to disable auto-completing of passwords.

That is wrong.

And in July 2014, Firefox was the last major browser to finally implement the change to ignore any web-site that tries to turn off autocompleting of passwords.

Any attempt by any web-site to circumvent the browser's preference is wrong; that is why browsers ignore it. There is no reason known why a web-site should try to disable saving of passwords.

  • Chrome ignores it
  • Safari ignores it
  • IE ignores it
  • Edge ignores it
  • Firefox ignores it

Microsoft even had to explain before IE11 that it wasn't a bug in the browser - that the web-site was broken: Why Won’t IE Remember My Login Info? (archive.is)

What if I'm a special snowflake?

There are people who bring up a good use-case:

I have a shared, public area, kiosk style computer. We don't want someone to (accidentally or intentionally) save their password so they next user could use it.

That does not violate the statement:

Any attempt by any web-site to circumvent the browser's preference is wrong

That is because in the case of a shared kiosk:

  • it is not the web-server that has the oddball policy
  • it is the client user-agent that has the oddball policy

The browser (the shared computer) is the one that has the requirement that it not try to save passwords.

The correct way to prevent the browser from saving passwords
is to configure the browser to not save passwords.

Since you have locked down and control this kiosk computer: you control the settings. That includes the option of saving passwords.

In Chrome and Internet Explorer, you configure those options using Group Policies (e.g. registry keys).

From the Chrome Policy List:

AutoFillEnabled


Enable AutoFill

Data type: Boolean (REG_DWORD)

Windows registry location: Software\Policies\Chromium\AutoFillEnabled

Description: Enables Chromium's AutoFill feature and allows users to auto complete web forms using previously stored information such as address or credit card information. If you disable this setting, AutoFill will be inaccessible to users. If you enable this setting or do not set a value, AutoFill will remain under the control of the user. This will allow them to configure AutoFill profiles and to switch AutoFill on or off at their own discretion.

Please pass the word up to corporate managers that trying to disable autocompleting of password is wrong. It is so wrong that browsers are intentionally ignoring anyone who tries to do it. Those people should stop doing the wrong thing.™


We need to prevent governments, corporate polcies, security auditors, PCI, HIPPA from trying to prevent users from saving passwords. There is no valid use case to prevent a user from saving their credentials.

  • If you have a password reset screen: the password should be entered in an unmasked plaintext box
  • If you want a 2FA password: the password should be entered in an unmasked plaintext box
  • If you have a one-time password: the password should be entered in an unmasked plaintext box

You are free to suggest an alternative that:

  • allows a web-site to prevent saving of passwords
  • as long as it can never be used to prevent a user from saving any passwords

Put it another way

In other words:

  • if the users browser
  • mistakes "Please enter the name of your favorite maiden name's first color." for a new password
  • and the user
  • doesn't want their browser
  • to update their password,
  • then they
  • will click Nope

enter image description here

It's not your job to over-rule the user's wishes. It's their browser; not yours.

34 Comments

Riiiight. We can trust thousands of proctors to read the message and not click a button or hit the enter key, not even on accident.
Let's put the security of online testing in trusting all human proctors will click the right button.
New usecase: I have a user administration page that is attempting to save+autocomplete password fields to my browser for the user I'm trying to admin... which obviously does not make sense. There are pages where you can input a password, but it is not actually our current user credentials... especially if it's just looking at the first text input field on the form which isn't even the user's username... ....
What about a case when I want to use a password input on a subpage of my site, and that password protects just this one subpage? This even isn't a password for the site, so browser prompting me to "update my password" is plain wrong. I have many subpages like this, each with own password. How to go about this?
@Ian Body thanks. I can't use group policy, I don't want to disable remembering passwords for the whole site, just one subpage. Especially that for an authenticated user browser wants to update the site-level password - which will end up with this user not being able to log in again using the stored credentials. If I am left with text input in this case then it is really disappointing - masking the password is a huge pain.
|
3

Current state of the Web-App vs. Browser Developer war:

Setting the password input's type and text is no longer adequate as of August 2021. Furthermore, Chrome prompts for password even if no form submission takes place. Simply detaching the password input element generates the prompt. Fer crying out loud. (Possibly triggered by a navigator fragment-only state transition used to route the browser back button onto the dialog's cancel button, which doesn't do a form submit either. There is no form element).

The following code is from a react app, but applicability should be obvious.

 let passwordInput = this.refPassword.current; if (passwordInput) { passwordInput.setAttribute("value",""); // overwrite the password. passwordInput.setAttribute("type","text"); // change the type of the input element. } // delay dismissing the dialog. setTimeout(()=> { // dismiss the dialog. this.props.onCancel(); }); 

Without the setTimeout call, Chrome 92.0.4515.159 currently prompts to save the password with the value of the password input before the value was set to "" if the input control is detached immediately by, for example, pressing the "Cancel" button. The setTimeout call is required to prevent this behavior. Personally, I prefer this solution to using the -webkit styles, because it is -- for the meantime -- relatively portable.

For those who would defend browser developers' actions, this is the use case. The application is a single-page web app developed with react framework. The dialog in question is the configuration dialog for the Wi-Fi access point on an IoT device. The password box contains the WEP passphrase for the Wi-Fi access point (it has a visible/non-visible password decoration, and code to display "(Unchanged)" if the password has not yet been edited so that stored passwords never get sent back to the web app). The code in question prevents a password save prompt in the case where the user has clicked the cancel button, even if the password input is in error state because the password doesn't meet the the minimum-length of 8 characters required by WEP!

Clicking on save for the WEP passphrase overwrites the actual site password with the WEP passphrase. Clicking on "Never" disables saving of the main site password. So in terms of respecting user intent, the purpose here is to PREVENT the user from doing something catastrophic such as clicking the "Never" button, which will prevent password saving for the actual login dialog, where it's needed.

Is there some security motivation going on here that has caused browser developers to escalate this battle so severely? I just can't imagine what the security consequences of NOT saving a password would be.

Comments

2

You can change the type of the password field to text before submitting the form:  

<script type="text/javascript"> function validate() { return true; } function copyPass() { document.getElementById("hidPassword").value = document.getElementById("passwordField").value; if (document.getElementById("passwordField").value != "") { var passwordLength = document.getElementById("passwordField").value.length; document.getElementById("passwordField").value = "•".repeat(passwordLength); } document.getElementById("passwordField").type = 'text'; } function changeType() { document.getElementById("passwordField").type = 'password'; document.getElementById("passwordField").value = document.getElementById("hidPassword").value; } </script> <form method="post" action="yoururl" runat="server"> <input type="text" name="username" /> <input type="password" id="passwordField" name="passwordField" onfocus="javascript:changeType()" onblur="javascript: copyPass()" /> <input type="hidden" name="hidPassword" id="hidPassword" value="" /> <input type="submit" runat="server" name="btnsubmit" value="Submit" onclick="javascript:return validate()" /> </form> 

Comments

1

I found out that whatever you do, recent browsers save the value of input field which is of type="password". I found a workaround. What i did was, i turned the password field type into text field (type="text") and masked the value. Now chrome wont save your password field as now it is a "text" field.

@font-face { font-family: "password-font"; src: url(data:font/woff;charset:utf-8;base64,d09GRgABAAAAAAusAAsAAAAAMGgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZjRmM5Y21hcAAAAYQAAAgCAAArYmjjYVVnbHlmAAAJiAAAAEEAAABQiOYj2mhlYW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wMqYAIAK/QBvQAAAAADIAAAAAAAAAAoAAB4nGNgZGBgYGIQA2IGMIuBgQsIGRj+g/kMAArUATEAAHicjY69TsMwFIWP+4doJYSKhMTmoUJIqOnPWIm1ZWDq0IEtTZw2VRpHjlu1D8A7MPMczAw8DM/AifFEl9qS9d1zzr3XAK7xBYHqCHTdW50aLlj9cZ1057lBfvTcRAdPnlvUnz23mXj13MEN3jhBNC6p9PDuuYYrfHquU//23CD/eG7iVnQ9t9ATD57bWIgXzx3ciw+rDrZfqmhnUnvsx2kZzdVql4Xm1DhVFsqUqc7lKBiemjOVKxNaFcvlUZb71djaRCZGb+VU51ZlmZaF0RsV2WBtbTEZDBKvB5HewkLhwLePkhRhB4OU9ZFKTCqpzems6GQI6Z7TcU5mQceQUmjkkBghwPCszhmd3HWHLh+ze8mEpLvnT8dULRLWCTMaW9LUbanSGa+mUjhv47ZY7l67rgITDHiTf/mAKU76BTuXfk8AAHicY2BigAARBuyAiZGJkZmBJSWzOJmBAQALQwHHAAAA) format("woff"); } .myPassword { font-family: password-font; }
<input type='text' autocomplete="off" class="myPassword" />

Comments

0

It seems in the later versions of Chrome, they have decided to ignore autocomplete="off" for passwords... See:

https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/zhhj7hCip5c/PxbtDtGbkV0J

Here's another person answering this question with a hacky solution you might be able to try, if it's a project requirement:

Chrome Browser Ignoring AutoComplete=Off

1 Comment

It doesn't seem that issue is directly relevant. It now ignores autocomplete (terrible behavior), but this question is how you can prevent it from prompting the user to save it and remember it - I'll add a screenshot.
0

I found a way to make Chrome ignore password/username combination even they all in that name.

<input name='username' type='text'> <input name='password' type='password' onblur='this.type="password"' onfocus='this.type="text"'> 

The keypoint is to set onblur and onfocus with type change.

You can do it also by:

$('input[name="password"]').blur(function(){ $(this).attr('type', 'password') }) $('input[name="password"]').focus(function(){ $(this).attr('type', 'text') }) 

Don't know why. I guess it's a bug.

Comments

0

I fixed with the following markup

#txtPassword { -webkit-text-security: disc; }
<form autocomplete="off"> <input type="text" name="id" autocomplete="off"/> <input type="password" id="prevent_autofill" autocomplete="off" style="display:none" tabindex="-1" /> <input type="password" name="password" id="txtPassword" autocomplete="off"/> <button type="submit" class="login100-form-btn">Login</button> </form>

2 Comments

Why the same is not working in ASP.net MVC View or .CSHTML page?
This solution stopped working after browser upgrade. On one of the (may be few) versions it works.
-3

To stop Chrome from asking to save your passwords:

  1. Click the Chrome menu 3 dots in the toolbar and choose Settings.
  2. Click Autofill > Passwords.
  3. Turn off “Offer to save passwords”. enter image description here

Source : https://support.1password.com/disable-browser-password-manager/

1 Comment

That's for your own browser, not for people on their own browsers using your website

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.