How to disable text box memory function method collection

  • 2020-12-18 01:48:28
  • OfStack

As web developers, however, we don't want everything to be stored on the user's computer (such as bank accounts and other important accounts and passwords), but we can't ask users to disable autocomplete. Fortunately, es1EN5.0 is INPUT type=password, INPUT type=text, FORM and other controls have added an AUTOCOMPLETE attribute. To disable the automatic completion function of the control, just set AUTOCOMPLETE to off, as follows:

The entire form is disabled


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

Disable auto-complete of text boxes


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

Autocomplete is disabled in the script


function init()
{
    element.setAttribute("AutoComplete", "off");
}

In addition, if you want to disable the text box, you can add ES29en-ES30en: disabled to its style, but this does not prevent Chinese characters from being typed, as the user can still copy and paste them. Such as:


<input type=text style="ime-mode: disabled ; ">

Microsoft's.NET PASSPORT is implemented in this way, but there should be other ways, because the implementation methods in YAHOO and GMAIL are not the same.

What's new about TextBox controls in NET? Well! There is a seemingly small but often troublesome "improvement" called "autocomplete" (AutoComplete). What is automatic completion? TextBox will remember the text that the user has typed and will automatically prompt for the relevant word when entering it again. Most commonly, the user will bring out the account password when logging into the website.

When it was first invented, it was thought to be very convenient and easy to use. However, with the increasing awareness of information security, this feature is sometimes not only unpleasant, but also a little annoying. Why? Whether at home, at Internet cafes or at work, there are many opportunities for multiple people to share a computer, and thanks to TextBox's automatic completion, it is not difficult for others to see your ES50en-ES51en and even use your account to log on to the web. As long as you select your account from TextBox, the password will usually be 1 and be taken out automatically.

One friend after another asked me how to solve this annoying problem. The AutoCompleteType property built into ASP.NET 2.0's TextBox control can easily solve this problem, as long as the AutoCompleteType of TextBox is set to "Disable", the autocomplete prompt will not appear at all.


Related articles: