-3

I have used autocomplete="off" but not working in password input please check below atteched my demo code.

  <form name="testfrm" ng-submit="test(testfrm)" autocomplete="off">
       <input type="password" id="passwordFiled" name="test" autocomplete="off"  required>
       <button type="submit" class="btn"> test </button>
  </form>

Please let me know how to disabled autocomplete for password filed

  • 1
    Configure your browser to not store passwords then? Don’t try to mess with how I want to handle _my_ passwords in _my_ browser. Forcing users to handle things are certain way, just because you think it was the right one, does not actually increase security; rather often probably the contrary. – CBroe Feb 20 '20 at 09:05
  • @CBroe Yes man you are right, but if any solution for autocomplete off in your side please let me know – Bhavin Patel Feb 20 '20 at 09:11
  • Does this answer your question? [How do you disable browser Autocomplete on web form field / input tag?](https://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag) – Julien Feb 20 '20 at 09:22

1 Answers1

0

You can add a name-changer function for the password field, it can be a possible solution, here's the code I tried:

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
        <script>

            // Returns random string based on 32 different characters and 4 dashes ("-")
            function string_generator() {
                var str = function() {
                   return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
            };
            return (str() + str() + "-" + str() + "-" + str() + "-" + str() + "-" + str() + str() + str());
        }

        $(document).ready(function() {
            $("#passwordField").attr("name", string_generator());
        });
        </script>
    </head>

    <body>
        <form name="testfrm" ng-submit="test(testfrm)">
            <input type="password" id="passwordField" name="test" autocomplete="off" required>
            <button type="submit" class="btn"> test </button>
        </form>
    </body>
</html>

Let me know if it works (if it doesn't work, please check the password-field id, because in my code is "passwordField", while in your is "passwordFiled")

Anyway, if you need the original name test as the url variable, this answer is supposed to be useless

xKobalt
  • 1,478
  • 2
  • 11
  • 19