Map input autocomplete types in Chrome 15+

Chrome 15 and above supports mapping input fields to specific types of data to improve the accuracy of autofill tools. Typically an autofill tool, either bundled with the browser or a third-party add-on, scans the page’s <input>s and attempts to derive some meaning from the field’s name attribute and new HTML5 input type attribute values such as email or tel. The new WHATWG autocompletetype attribute proposal from Ilya Sherman of Google proposes 36 mapped tokens and two sections for autofill agents entering name, address, contact, credit card, business, or birthday data in a web browser.

<input type="text" x-autocompletetype="name-full">Name
<input type="email" x-autocompletetype="email">Email
<input type="text" maxlength="16" x-autocompletetype="cc-number">Credit card

Google Chrome 15+ (November 2011 stable channel and later) parses an “x-autocompletetype” attribute from an <input> and attempts to match the proposed standard tokens with a list of Chrome autofill types stored locally (and possibly on Google’s autofill servers). If the current user has entered their name, email, and credit card number into their browser’s autofill storage your webpage might receive very accurate pre-populated fields.

I added x-autocompletetype attributes to this post’s comment fields if you would like to try it out.

  • Posted
  • Updated at
  • No comments