What would cause Chrome autofill to stop working?

后端 未结 6 1436
既然无缘
既然无缘 2021-01-04 09:02

I\'ve got a new site we\'re working that uses HTML5. Everything validates except for the LESS stylesheets and the Facebook tags. However, Chrome will not autofill properly.

相关标签:
6条回答
  • 2021-01-04 09:38

    The only way I know of in HTML to block it is setting: autocomplete="off" on the inputs.

    I know drop downs don't work sometimes with autofill, but not text boxes.

    0 讨论(0)
  • 2021-01-04 09:41

    I have just fighted with this issue for a while, I found out that a "name" attribute with a dash like "email-2" would cause Chrome not to autocomplete the field. In my case I have changed it to email2 and now it works. It only affects the "name" attribute, while the "id" attribute does not make any difference.

    I hope this help someone to save time with such a silly bug.

    Greetings from Argentina!

    0 讨论(0)
  • 2021-01-04 09:44

    Sorry I can't give you a definitive answer, but I would start with removing everything from the page except that input field. If it works then I would start "binary search" - remove half of the original layout and see if it works, if it isn't - remove another half of what's left and so on, until problem line is found.

    Same could be applied to css, js, etc. It is a pretty effective way of searching for errors (for 1024 lines of code you will find exact problem line in just 10 steps).

    0 讨论(0)
  • 2021-01-04 09:48

    Only Those elements which require autofill should be there inside the form.otherwise the autofill wont work.Bring only those textboxes under a form.if u already have form involving other elements,separate them and put new form tag around the textboxes which require autofill and nothing else inside it.

    0 讨论(0)
  • 2021-01-04 09:54

    Chrome will not save password or autocomplete data if a form is submitted asynchronously. For example, if you submit the following form, Chrome will prompt you to save the password:

    <form action="/signin">
        <input type="text" name="email" />
        <input type="password" name="password" />
        <button type="submit">Sign In</button>
    </form>
    

    However, if you bind to the submit event and override the default behavior, there will be no prompt and the autocomplete data won't be saved:

    $(function(){
        $('form').submit(function(e){
            e.preventDefault();
            $.post($(this).attr('action'), $(this).serialize());
        });
    });
    

    Tested in 20.0

    0 讨论(0)
  • 2021-01-04 09:56

    It seems that Chrome only enables the autofill for forms with a POST method. This may have been a security update on a recent version.

    Autofill will work if you do:

    <form id="myForm" action="?go" method="post">

    It won't work if you omit the method or it's set to get:

    <form id="myForm" action="?go" method="get">

    <form id="myForm" action="?go">

    0 讨论(0)
提交回复
热议问题