如何防止浏览器存储我的用户名&密码? [英] How to prevent browser from storing my username & password?

查看:87
本文介绍了如何防止浏览器存储我的用户名&密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止浏览器存储我的用户名和密码?我希望用户每次登录时都输入它们。



用户名和密码是TextBoxes

How to prevent browser from storing my username & password? I want the user to enter them everytime he login.

Username & Password are TextBoxes

推荐答案

<大>解决方案



在这些字段或表单上使用 autocomplete =off。< br $> b $ b



推荐



1. < a href =http://www.proficientit.com.au/blog/?p=184> ASP.NET - 禁用密码/用户名的保存 [ ^ ]



2。 禁用浏览器保存密码功能 [ ^ ]

Solution

Use autocomplete="off" on those fields or on form.


Refer

1. ASP.NET – Disable saving of password / user name[^]

2. Disable browser 'Save Password' functionality[^]
Quote:

I我不确定它是否适用于所有浏览器,但你应该尝试在表单上设置autocomplete =off。

I'm not sure if it'll work in all browsers but you should try setting autocomplete="off" on the form.

<form id="loginForm" action="login.cgi" method="post" autocomplete="off">




引用:

禁用表单和密码存储提示并阻止表单数据在会话历史记录中缓存的最简单方法是使用值为off的自动完成表单元素属性。



来自 http://developer.mozilla.org/En/How_to_Turn_Off_Form_Autocompletion [ ^ ]

The easiest and simplest way to disable Form and Password storage prompts and prevent form data from being cached in session history is to use the autocomplete form element attribute with value "off".

From http://developer.mozilla.org/En/How_to_Turn_Off_Form_Autocompletion[^]



一些小型研究表明这一点在IE中工作,但我不会保证;)



@Joseph:如果严格要求用实际标记传递XHTML验证(不知道为什么会这样?理论上你可以用javascript后添加这个属性,但是那些禁用了js的用户(如果你的网站需要js,可能是你的用户群可忽略不计的数量或零)仍然会保存他们的密码。



jQuery示例:


Some minor research shows that this works in IE to but I'll leave no guarantees ;)

@Joseph: If it's a strict requirement to pass XHTML validation with the actual markup (don't know why it would be though) you could theoretically add this attribute with javascript afterwards but then users with js disabled (probably a neglectable amount of your userbase or zero if your site requires js) will still have their passwords saved.

Example with jQuery:


' #loginForm')。attr(' autocomplete'' off');
('#loginForm').attr('autocomplete', 'off');




注意:

Quote:

只是一个快速评论,因为这是改变,HTML5将自动完成属性添加到规范,所以它现在有效。

Just a quick comment, since this is changing, HTML5 adds the autocomplete attribute to the spec, so it is valid now.


这篇关于如何防止浏览器存储我的用户名&amp;密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆