在MVC删除浏览器自动完成 [英] Remove browser autocompletion in MVC
问题描述
目前我正在试图以消除用户的浏览器完成的形式自动完成这可能会导致一些重要的行为,因为它填补了密码字段。我已经自动完成属性已经添加到我所有的文本框,但是当我与Firefox尝试剧照加载我当前的登录信息的字段。
I am currently trying to remove the form autocompletion done by the user's browser which can cause some critical behavior since it fills the password field. I have already add the autocompletion attribute to all of my textbox but when i try with firefox it stills load my current login information into the fields.
做一个你找到一个方式来解决这个问题?
Do one you find a manner to resolve this issue ?
在此先感谢。
编辑:由于它是不明确的,我已经和设置的值加aucompletion属性设置为OFF
EDIT : Since it's not clear, i have already add the aucompletion attribute with the value set to "off".
推荐答案
有是HTML中的自动完成=关闭
属性。
There is an autocomplete=off
property in html.
这是在右上角的搜索框使用这个非常页面上,检查你会看到HTML:
It is used in the top right search box on this very page, inspect the html you'll see:
<input autocomplete="off" name="q" class="textbox" placeholder="search" ..... />
请参阅此MDN文章:<一href=\"https://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion\">https://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion
在MVC你会在形式或为象这样一个文本框实现这个:
In MVC you would implement this at the form or for a textbox like so:
Html.BeginForm(
action, controller, FormMethod.Post, new {autocomplete="off"})
或
Html.TextBoxFor(model => model.EmployerNumber, new {autocomplete="off"})
这篇关于在MVC删除浏览器自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!