How to turn off browser auto-complete/auto-suggest on forms
Many times in web-development we want to turn off default browser auto-complete feature to turn off due to vary nature of our application and usage. For example if your use-case is based on the type of your application is such that you're building secure (financial/banking or any application with high-level of confidentiality) where you don't want browsers to remember usernames you can use attribute "autocomplete" in HTML form's INPUT elements to turn it off.
Use autocomplete="off" for all the fields for which you want to turn off autocomplete. Certain browsers might just not comply or understand this tag at input level in that case you will have to disable them at form level as well. Some version of Chrome browser is observed to have such issues, but for other than exceptions for rest of the others you can simply specify autocomplete="off" like following example:
<!-- To disable autocomplete for specific input element --></p> <form action="/forgotPassword/action" method="post"><input autocomplete="off" name="username" type="text" /><input name="ForgotPassword" type="submit" /></form> <p>
<!-- To disable autocomplete for all input elements within the form --></p> <form action="/forgotPassword/action" autocomplete="off" method="post"><input name="username" type="text" /><input name="ForgotPassword" type="submit" /></form> <p>
While I am writing this, Chrome in my system is updated to version 39.x and it respects autocomplete="off" attribute without any problem. But at the same time Safari 8.0.2 in my Mac do not show suggestions even when I don't have this attribute specified. Both Firefox 34 and Chrome 39 respects autocomplete attribute at both form and element level, so you can apply it based on your need.