Click to return to the Essentials home page    
Web Workshop  |  Essentials

Tailoring AutoComplete for Your Site


Frank Chang
Microsoft Corporation

March 10, 1999

Summary

Certain sites may contain sensitive information that the user doesn't want AutoComplete to remember. Internet Explorer 5 offers several options for both users and Web authors to tailor AutoComplete to suit their particular needs. This document will illustrate how to use those options to customize AutoComplete.

What the User Can Do

AutoComplete is off by default, and users are prompted by Internet Explorer, which asks whether they want to turn the feature on. Once in use, the information stored by AutoComplete can be cleared at any time by going to the AutoComplete control panel located under the Content tab of the Internet Options dialog box. If a user merely wants to delete a specific entry in a field, he can highlight the entry in the AutoComplete dropdown and press the Delete key.

What the Web Author Can Do

With AutoComplete, we introduced a new attribute that can be used in <FORM> tags. The attribute is "AUTOCOMPLETE," and when it is set equal to "OFF," AutoComplete will not be used for the entire form that follows. Example:

<FORM method=post action="submit.asp" AUTOCOMPLETE="OFF">

AutoComplete can also be disabled on a per-field basis using the same attribute. This time, the attribute is located in the input field. For example:

<input type="text" name="creditcard" value="" 
  size="16" maxlength="16" AUTOCOMPLETE="OFF">

If you have a lot of <FORM> tags, and don't feel like adding all the AUTOCOMPLETE="OFF" attributes, you can use a DHTML behavior to add them automatically. This example .htc file will do the trick:

<PUBLIC:HTC>

<PUBLIC:ATTACH EVENT="oncontentready" HANDLER="init" />

<SCRIPT>
function init()
{
    element.setAttribute("AutoComplete", "off");
}
</SCRIPT>

</PUBLIC:HTC>

Download the .htc file.

Once the .htc file is on the server, reference it in the <HEAD> of your HTML code:

<HEAD>
<STYLE>
    FORM { behavior:url(autocomp.htc) }
</STYLE>
</HEAD>

Note that while this method works, we highly recommend that the AUTOCOMPLETE="OFF" attribute is explicitly added to each <FORM> element.

AutoComplete is automatically disabled in kiosk mode, and it can be disabled via the Internet Explorer Administrator Kit as well.

Knowing this information can afford users the benefits of AutoComplete, while allowing Web authors assurance that sensitive information is not stored unknowingly.



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.