How do you disable browser Autocomplete on web for

2018-12-30 23:52发布

How do you disable autocomplete in the major browsers for a specific input (or form field)?

30条回答
琉璃瓶的回忆
2楼-- · 2018-12-31 00:40

try these too if just autocomplete="off" doesn't work:

autocorrect="off" autocapitalize="off" autocomplete="off"
查看更多
大哥的爱人
3楼-- · 2018-12-31 00:41

Just set autocomplete="off". There is a very good reason for doing this: You want to provide your own autocomplete functionality!

查看更多
浪荡孟婆
4楼-- · 2018-12-31 00:41

I've solved the endless fight with Google Chrome with the use of random characters.

<input name="name" type="text" autocomplete="rutjfkde">

Hope that it will help to other people.

查看更多
刘海飞了
5楼-- · 2018-12-31 00:42

The solution for Chrome is to add autocomplete="new-password" to the input type password.

Example:

<form name="myForm"" method="post">
<input name="user" type="text" />
<input name="pass" type="password" autocomplete="new-password" />
<input type="submit">
</form>

Chrome always autocomplete the data if it finds a box of type password, just enough to indicate for that box autocomplete = "new-password".

This works well for me.

Note: make sure with F12 that your changes take effect, many times browsers save the page in cache, this gave me a bad impression that it did not work, but the browser did not actually bring the changes.

查看更多
倾城一夜雪
6楼-- · 2018-12-31 00:42

None of the solutions worked for me in this conversation.

I finally figured out a pure HTML solution that requires no Javascript, works in modern browsers (except IE; there had to at least 1 catch, right?), and does not require you to disable autocomplete for the entire form.

Simply turn off autocomplete on the form and then turn it ON for any input you wish it to work within the form. For example:

<form autocomplete="off">
    <!-- these inputs will not allow autocomplete and chrome 
         won't highlight them yellow! -->
    <input name="username"  />
    <input name="password" type="password" />
    <!-- this field will allow autocomplete to work even 
         though we've disabled it on the form -->
    <input name="another_field" autocomplete="on" />
</form>
查看更多
像晚风撩人
7楼-- · 2018-12-31 00:42

None of the hacks mentioned here worked for me in Chrome. There's a discussion of the issue here: https://code.google.com/p/chromium/issues/detail?id=468153#c41

Adding this inside a <form> works (at least for now):

<div style="display: none;">
    <input type="text" id="PreventChromeAutocomplete" name="PreventChromeAutocomplete" autocomplete="address-level4" />
</div>
查看更多
登录 后发表回答