关于记住支付密码

有好几种解决方式,甚至是好几层解决方案。

1 最简单的一层: 在所有你希望不要被记住的input或者其他输入框上 加入: autocomplete=off 当然密码也不例外

2 本来想写JavaScript去动态地改变 input的type 从 text改成password 结果 发现 html的安全规范中不支持 这么做

3 最终我采取了这种方式:

<!--[if lte IE 9]>
  <input type="password" class="text01" name="payPassword" id="payPassword" 
  placeholder="输入交易密码" maxlength="20" autocomplete="off"/>
<![endif]-->
 
<![if !IE]>
  <input type="text" class="text01" name="payPassword" onfocus="this.type='password'" 
  id="payPassword" placeholder="输入交易密码" maxlength="20" autocomplete="off"/>
<![endif]>

这种方式,虽然能对付过:IE8,IE9,IE10,IE11,Chrome但是 Firefox过不了。 所以最终发现 财富派的解决方案比较好。

4 财富派的做法 https://www.caifupai.com

<input type="password" data-ignore-success="true" autocomplete="off" 
data-msg-required="请输入交易密码" required="true" 
placeholder="请输入交易密码" class="input_text" data-type="password" 
style="display: none;" aria-required="true">

<input type="text" data-ignore-success="true" autocomplete="off" 
data-msg-required="请输入交易密码" required="true" 
placeholder="请输入交易密码" class="input_text" data-type="password" name="transpwd" id="transpwd">
					

根据 onfocus以后自动隐藏一个,显示另外一个。

关于记住密码 更合理的需求

看过了 www.alipay.com, www.caifupai.com, www.1qianbao.com 我发现他们都没有防止到firefox和chrome的记住密码功能对这些网站 登录密码的记住。 但是在 交易密码方面 做得很严格,严格不让浏览器记住交易密码。