skip to Main Content

I was tried to prevent to store the username and password in Google Chrome password manager. so, i was changed the type password to text in the password field using following lines in JQuery in $(document).ready section.

     var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
    if (isChrome) {
        $("#UserPassword").attr("type", 'text');
        $("#UserPassword").attr("style", "-webkit-text-security:disc;");
    }
    else {
        $("#UserPassword").attr("type", 'password');
    }

but, i faced, some issue due to the address fill suggestion. it shows the already typed values in the suggestion. how to prevent show the suggestion in field or how prevent google chrome password manager to save the password from my site.

enter image description here

Enable Suggestion in Google Chrome:

  1. Open settings page in Google Chrome
  2. Select Autofill and password in left panel
  3. Then select the Addresses and more in Right Panel and enable the Save and fill addresses option.

Any one knows please give me suggestion for solve this issue

2

Answers


  1. Chosen as BEST ANSWER

    I am asked about autofill in field. i required for avoid show suggestion in that fields.

    Now, i got one solution for avoid this scenario.

    In the Suggestion show based on the field name.

    function formsubmit(e){
        e.preventdefault();
        $("#userpassword").attr("name","Password"");
        $("#loginform").submit();
    }
    
    
     <form action="/account/login" id="loginform" >
        <input type="text" name="123123124343_Password" id="userpassword"></input>
        <input type="submit" onclick="formsubmit()" value="Login"></input>
       </form>
    

    so,i was set the dynamic name for the field with unique id. in form submit event, i changed the field name as i required.

    Now, the suggestion box is not appeared in that field


  2. Using JavaScript, you can disable text box suggestions in Google Chrome by using the autocomplete attribute of the input element.

    var inputElement = document.getElementById("myInput");
    inputElement.setAttribute("autocomplete", "off");
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search