Jordan H
Jordan H

Reputation: 55845

Prevent Chrome from prompting to save password from input box?

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

Upvotes: 17

Views: 32229

Answers (10)

iScream
iScream

Reputation: 11

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,d09GRgABAAAAAAusAAsAAAAAMGgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZjRmM5Y21hcAAAAYQAAAgCAAArYmjjYVVnbHlmAAAJiAAAAEEAAABQiOYj2mhlYWQAAAnMAAAALgAAADYOxVFUaGhlYQAACfwAAAAcAAAAJAqNAyNobXR4AAAKGAAAAAgAAAAIAyAAAGxvY2EAAAogAAAABgAAAAYAKAAAbWF4cAAACigAAAAeAAAAIAEOACJuYW1lAAAKSAAAAUIAAAKOcN63t3Bvc3QAAAuMAAAAHQAAAC5lhHRpeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgP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D/eG7iVnQ9t9ATD57bWIgXzx3ciw+rDrZfqmhnUnvsx2kZzdVql4Xm1DhVFsqUqc7lKBiemjOVKxNaFcvlUZb71djaRCZGb+VU51ZlmZaF0RsV2WBtbTEZDBKvB5HewkLhwLePkhRhB4OU9ZFKTCqpzems6GQI6Z7TcU5mQceQUmjkkBghwPCszhmd3HWHLh+ze8mEpLvnT8dULRLWCTMaW9LUbanSGa+mUjhv47ZY7l67rgITDHiTf/mAKU76BTuXfk8AAHicY2BigAARBuyAiZGJkZmBJSWzOJmBAQALQwHHAAAA) format("woff");
}



.myPassword {
      font-family: password-font;
  }
<input type='text' autocomplete="off" class="myPassword" />

Upvotes: 1

Suresh Kamrushi
Suresh Kamrushi

Reputation: 16086

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/

Upvotes: -3

Robin Davies
Robin Davies

Reputation: 7834

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.

Upvotes: 3

Ian Boyd
Ian Boyd

Reputation: 257001

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.

Upvotes: 8

Prasanna Jathan
Prasanna Jathan

Reputation: 590

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>

Upvotes: 0

Martin
Martin

Reputation: 10563

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

Upvotes: 24

Kyan
Kyan

Reputation: 403

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.

Upvotes: 0

Mukesh
Mukesh

Reputation: 21

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>

Upvotes: 2

Jordan H
Jordan H

Reputation: 55845

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.

Upvotes: 11

Mazzy
Mazzy

Reputation: 327

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

Upvotes: 0

Related Questions