Search code examples
htmlgoogle-chrome

autocomplete= off not working in chrome


We are working on one web application in that one payment page is there.

In that we have two Text box one is for Credit Card Number and second one is for Verification Code and it type="Password".

Now problem is when page is load in google-chrome it found type="Password" it load Save email id in Credit Card Textbox and password in Verification Code.

Now try to solve this issue i was try out something like below.

<form autocomplete="off">

<asp:textbox autocomplete="off">

This above try is not work for me. i was googling it but by luck it's not work for me.


Solution

  • It appears that Chrome now ignores autocomplete="off" unless it is on the <form autocomplete="off"> tag since v34.

    you can't cheat by create an hidden input over. Auto complete feature will get the first input text to fill data.

    Method 1:

    <form id="" method="post" action="" autocomplete="off">
        <input type="text" style="display:none" />
        <input type="password" style="display:none">
        <asp:textbox autocomplete="off">
    </form>
    

    So put this before your textbox.

    <input type="text" style="display:none" />
    

    Method 2:

    Change

    autocomplete="off" 
    

    to

    autocomplete="false" 
    

    Method 3: Browser autofill in by readonly-mode.

     <input type="password" readonly onfocus="this.removeAttribute('readonly');"/>
    

    Method 4:

    For username password combinations. Chrome heuristics looks for the pattern.

    <input type="text" onfocus="this.type='password'">
    

    Method 5: jQuery

    if ($.browser.webkit) {
        $('input[name="password"]').attr('autocomplete', 'off');
        $('input[name="email"]').attr('autocomplete', 'off');
    }