Autocomplete is a useful feature for the Internet surfers who go to a lot of websites and fill countless registration forms. Autocomplete helps these Internet users to quickly fill their details in the web forms. When a user fills in the first registration form in a fresh browser installation, the browsers (like Firefox, Google Chrome, Internet Explorer, Safari etc.) save the filled in details. When the user fills another similar web form, the browser will automatically fill the saved details in the form. Thus the browser saves time for the visitors.
But from the viewpoint of a web developer, autocomplete is sometimes a problem and the developer would want to turn off autocomplete. In such cases, the developer would want the visitor to fill in web form manually by typing everything. So, is it possible to disable autocomplete feature? The answer is, yes!
Most browsers honor the autocomplete=”off” attribute for the FORM tag of HTML. You can use this tag while coding your web form and browsers will disable autocomplete feature on that form.
But unfortunately different browsers have different standards. To be on the safer side, you should also disable autocomplete on the input tags as well. This approach has an advantage that you do not need to disable autocomplete for the entire form. Instead, you can be selective and turn off autocomplete only on certain input elements.
Here is an example:
<form autocomplete="off" name="myForm"> <input autocomplete="off" name="empName" type="text" /> <input name="empCode" type="text" /> </form>
Latest versions Firefox, Chrome and IE have a bit of different approach. These browsers circumvent autocomplete=”off” on password fields and prompts the user whether she wants to automatically enter the password or not. Such prompt comes only for the password fields. Google Chrome turns all the form fields light yellow color for which it has autocomplete information.
Browsers recognize form fields by their names and IDs. For example, let's assume, a user is filling a form which has a field with name firstname. The browser will save the entered name against an input field called “firstname“. During the filling of another web form if the browser finds a field named “firstname” —it will simply input the value that the user had entered in previous form.
So, if you notice that a browser is not honoring autocomplete=”off” attribute, you may consider giving IDs and names of your fields as random text. This will ensure that the browser will not be able to recognize the fields and therefore won't be able to fill in the data automatically.
In addition to the built-in facility inside the browser —many people also use Firefox and Chrome extensions to autofill the forms. These extensions, obviously, do not honor autocomplete=”off” attribute and the developer will not be able to disable autocomplete if such extensions are installed.
Giving random names and IDs to input fields is the only way to beat autofill extensions.
I hope this information on how to disable and turn off autocomplete feature was useful for you. Should you have any questions in this regard, please feel free to comment and ask. I will try my best to assist you. Thank you for using TechWelkin!