How to prevent Chrome from requesting to save credit card information

10,310

Solution 1

There's a good reason why Chrome ignores autocomplete="off" - it's not your information to decide whether or not the user's browser can save it. As such there is deliberately no way to disable this functionality programmatically.

You can make Chrome respect autocomplete="off" by setting the appropriate flag in chrome://flags which would give you the outcome you desire, but this only affects your browser - again, it's the user's information to decide to do with as they see fit.

Solution 2

What I did is using a hidden field for Credit Card Number and Save the actual credit card number in it then clear the actual Credit Card number from screen by JScript.

Solution 3

I had the same problem you're experiencing; and with a newer browser version.

Save card prompt

To resolve this, you have to set autocomplete at form element.

<form autocomplete="off" action="/cc.html" method="POST">
    <!-- Form fields -->
    <input type="text" name="cc" id="cc" />
    <!-- More form fields -->
</form>

For some reason Google Chrome ignores the autocomplete="off" at <input type="text" /> for Credit Card prompts, but doesn't prompt when you set it with <form>.

Share:
10,310
whatsnewsaes
Author by

whatsnewsaes

Updated on June 15, 2022

Comments

  • whatsnewsaes
    whatsnewsaes about 2 years

    I am trying to find a way to programmatically disable Chrome's "Do you want save this credit card info" prompt.

    I have tried adding autocomplete="off" to all the inputs as well as the form, yet this prompt still comes up.

    Is there a way to disable this programmatically?

    Unfortunately, this is different from Disable browser 'Save Password' functionality because this all revolves around tricking Chrome into thinking the input field is not a password field / simply using autocomplete="off", however Chrome no longer acknowledges autocomplete="off".

    This is the banner I'm referring to:

    Do you want chrome to save your credit card information

  • E_the_Shy
    E_the_Shy almost 8 years
    I disagree. I know my web page is asking a merchant for someone else's credit card number. Chrome tries to auto-fill the current user's credit card number. Which is useless and wrong. I don't expect my users to have to mess around in chrome://flags.
  • Frank Nocke
    Frank Nocke over 7 years
    Besides the tricks mentioned, perhaps you could permutate the fieldname (always attaching someRandomHash <input name="cardno5aCvG... <input name="cardno8FHV48... - filtering (normalizing) that when processing the returned form values (there'll always be just one (cardno.*)-value in the form, easily regExp-able...)
  • fletchsod
    fletchsod about 4 years
    The problem is we had to comply with merchant's security requirement due to multiplying security breach by hackers in web browsers. So it is a must. Also we have a dealer that know every customer's credit card info which is a violation of merchant's security rule too.
  • k3davis
    k3davis almost 3 years
    This answer trades one problem for another (accessibility), imho.