Disable browser 'Save Password' functionality

前端 未结 30 3700
失恋的感觉
失恋的感觉 2020-11-21 23:29

One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don\'t get m

30条回答
  •  轮回少年
    2020-11-22 00:03

    The cleanest way is to use autocomplete="off" tag attribute but Firefox does not properly obey it when you switch fields with Tab.

    The only way you could stop this is to add a fake hidden password field which tricks the browser to populate the password there.

    
    
    
    

    It is an ugly hack, because you change the browser behavior, which should be considered bad practice. Use it only if you really need it.

    Note: this will effectively stop password autofill, because FF will "save" the value of #prevent_autofill (which is empty) and will try to populate any saved passwords there, as it always uses the first type="password" input it finds in DOM after the respective "username" input.

提交回复
热议问题