1

I tried the following ways to turn off the browser autocomplete.

1.added autocomplete="off",autocomplete="false" and autocomplete="new_password" to form and input fields

<form autocomplete="off" name="cardForm" novalidate>
<div class="row form-group">
<label class="col-sm-2 control-label">Security Code</label>
<input type="password" class="form-control" id="securityCode"   ng-model="add.ccInfo.Securitycode" name="Security" autocomplete="off">
</div>

2. And also tried with adding hidden input fields in front of password fields like this

<input type="hidden" name="Security" > <input type="password" class="form-control" id="securityCode" ng- model="add.ccInfo.Securitycode" name="Security" autocomplete="off">

3.and also tried changing type of input field from text to password on getting focus to input field

<form autocomplete="off" name="cardForm" novalidate>
<div class="row form-group">
    <label class="col-sm-2 control-label">Security Code</label>
    <input type="password" class="form-control" id="securityCode" data-ng-focus="add.changeType()" id="securityCode"  ng-model="add.ccInfo.Securitycode" name="Security" autocomplete="false">
</div>

and js part

add.changeType = function () {
 var el = angular.element(document.querySelector('#securityCode'));
 el.attr("type", "password")
  }

its disable auto complete first time loads and if i click in the field it shows a list with saved passwords .how can i avoid that img hereenter image description here

Edison Augusthy
  • 1,535
  • 17
  • 32
  • As far as I know most passwordmanagers in browser ignore the `autocomplete` keyword. Also I believe it's `new-password` (with a dash instead of an underscore) – NullDev Nov 24 '17 at 13:33
  • Not possible. https://stackoverflow.com/a/41217255/8861405 – Kushtrim Nov 24 '17 at 13:33
  • 1
    Why would you block browser's autocomplete in the first place? It's so useful. It's like you want to frustrate your users – Jeremy Thille Nov 24 '17 at 13:34
  • @JeremyThille It's a common requirement by non-technical people. Sometimes you can argue all you want and you still have to implement it. – user247702 Nov 24 '17 at 13:35
  • I see... Makes sense. Stupidity everywhere :/ – Jeremy Thille Nov 24 '17 at 13:37
  • @JeremyThille I can imagine turning this feature off on public computers, where the user can save password by accident, and then anyone can view it later (by removing _hidden_ property) – Aleksey Solovey Nov 24 '17 at 13:38
  • In a similar vein, I often encounter sites which block pasting into password fields, which just encourages people to create weak, easily remembered/typed passwords. Thank goodness for browser extensions that remove these dumb limitations. And don't even get me started on sites which have a ridiculously low maximum password length. – delinear Nov 24 '17 at 13:58
  • Make the name of the input "new-password" as well. Or something random, which the browser can't understand. – DoubleA Mar 30 '22 at 11:27

0 Answers0