autocomplete =“off”和autocomplete =“nope”无法处理chrome

问题描述 投票:1回答:2

自动完成功能无效。我试过autocomplete="off"autocomplete="nope"autocomplete="false"。输入文本框中仍显示密码和用户名

@Html.EditorFor(model => model.CustomerPasswordVM.OldPassword, new { htmlAttributes = new { @class = "form-control" } })
asp.net-mvc html5
2个回答
0
投票

来自:https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

"off"
The browser is not permitted to automatically enter or select a value for this field.
It is possible that the document or application provides its own autocomplete feature,
or that security concerns require that the field's value not be
automatically entered.

    Note: In most modern browsers, setting autocomplete to "off" will not
prevent a password manager from asking the user if they would like to save
username and password information, or from automatically filling in those
values in a site's login form. See the autocomplete attribute and login 
fields.

这可能是你的问题吗?


0
投票

我也面临同样的问题,下面的代码帮助了我。

  @Html.EditorFor(model => model.CustomerPasswordVM.OldPassword, new { htmlAttributes = new { @class = "form-control", @readonly= "readonly", @onfocus = "this.removeAttribute('readonly');" } })
© www.soinside.com 2019 - 2024. All rights reserved.