Friday, August 1, 2014

autocomplete="off" is not working in chrome

This is one simple issue drove me crazy all afternoon...

I want to ignore the browser autofill option to save the password. Like, sometimes user select the option to save password for the website and Chrome just autofills the password for the user. But, the same machine can be used by multiple users. So you might want to protect the user password, even through user selects to save the password by mistake.

I started searching the solution in Google and I tried, autocomplete="off" for the <input />, it doesn't work, then someone in another post suggested, it will work only if you add autocomplete="off" to the <form /> tag.

Guess what? It didn't work. Since chrome is just ignoring the autocomplete="off" option.

I found a workaround to solve this issue. 

"Chrome autofill the password <input /> tag and the previous <input /> tag. 
So , I added 

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

It works like a charm. Autofill goes to these <input /> tag, which will not display and the real one works as expected.

No comments:

Post a Comment

Please include your thoughts/suggestion to make it as a better blog. If you find it useful, Please update with your valuable comments, so that others can use it.