现在的位置: 首页 > 综合 > 正文

解决方案:某些网页Firefox不能记住密码

2013年12月05日 ⁄ 综合 ⁄ 共 1892字 ⁄ 字号 评论关闭

Firefox
有个很方便的功能:记住密码。但是在某些网页上此功能却失效了,登陆时不提示保存密码,下次登录时又得重新输入,在登陆某些设置了较复杂密码的地方特别不方便。

为何会失效呢?其原因是网页作者在 input 中设置了 autocomplete 属性的值为 off

  1. <
    input
     
    type
    =
    "text"
     
    name
    =
    "pwd"
     
    autocomplete
    =
    "off"
    >
      

当Firefox发现存在这个属性,就不会记住密码咯。

显然我们不可能通知网站作者去掉这个属性 
:D 
,但并非没有办法解决。稍稍修改一下Firefox的配置文件即可搞定。

首先找到 nsLoginManager.js 文件。在Firefox安装目录下。例如:

C:/Program Files/Mozilla Firefox/components/nsLoginManager.js

搜索”_isAutoCompleteDisabled”,大约 719 行,可以看见如下片段

  1.     
    /*<br>
     
  2.     * _isAutoCompleteDisabled<br>
     
  3.     *<br>
     
  4.     * Returns true if the page requests autocomplete be disabled for the<br>
     
  5.     * specified form input.<br>
     
  6.     */
    <br>  
  7.    _isAutocompleteDisabled :  function
     (element) {<br>  
  8.        if
     (element && element.hasAttribute(
    "autocomplete"
    ) &&<br>  
  9.            element.getAttribute("autocomplete"
    ).toLowerCase() == 
    "off"
    )<br>  
  10.            return
     
    true
    ;<br>  
  11. <br>  
  12.        return
     
    false
    ;<br>  
  13.    },  

将倒数第三行的 return true; 修改为 return false;

保存,重启Firefox即可生效。


【上篇】
【下篇】

抱歉!评论已关闭.