代码之家  ›  专栏  ›  技术社区  ›  victoriah

如何防止保存密码?

  •  10
  • victoriah  · 技术社区  · 17 年前

    4 回复  |  直到 17 年前
        1
  •  8
  •   Zoredache    17 年前
        2
  •  6
  •   Community Mohan Dere    9 年前

    <input type="password" autocomplete="off" />
    

    另见这个问题: Disable browser 'Save Password' functionality

        3
  •  0
  •   BinaryHacker    17 年前
        4
  •  0
  •   Shyam Sharma    10 年前
          $(document).ready(function () {  $('input[autocomplete="off"]').each(function () {
    
                var input = this;
                var name = $(input).attr('name');
                var id = $(input).attr('id');
    
                $(input).removeAttr('name');
                $(input).removeAttr('id');
    
                setTimeout(function () {
    
                    $(input).attr('name', name);
                    $(input).attr('id', id);
                }, 1);
            });
        });