Rid Thyself of Autocomplete=Off in Firefox

Update, 12-15-09: See this script for an automated way to apply this change.

If you're at all like me, you use a password manager to keep track of all your passwords, and it works great. Most of the time. Except sometimes, it doesn't work, and you're confused why. Well, more often than not, it's because your password manager has been blocked by the web page you're viewing.

If you look closely at the code of the page, somewhere in it, you'll probably find something that looks like this:

<input class="button" type="submit"  name="login" value="login" autocomplete="off">

That autocomplete parameter that you see at the end there? Yeah, that's the one that's blocking your password manager. So we must block it, so it doesn't block us.

There's a couple approaches to this, but probably the best is to disable Firefox's ability to interpret autocomplete. The way to do this on Linux is to browse to:

/usr/lib/xulrunner-1.9.1.5/components/nsLoginManager.js

And in Windows, I believe it's at:

C:\Program Files\Mozilla Firefox\nsLoginManager.js

Once you've found that file, open it in an editor, and find the section that has isAutoCompleteDisabled, and make it look like this (so it will always return FALSE):

    /*
    * _isAutoCompleteDisabled
    *
    * Returns true if the page requests autocomplete be disabled for the
    * specified form input.
    */
    _isAutocompleteDisabled :  function (element) {
    //        if (element && element.hasAttribute(”autocomplete”) &&
    //            element.getAttribute(”autocomplete”).toLowerCase() == “off”)
    //            return true;
 
    return false;
    },

Once that's done, save the file, restart Firefox and you're all set.

Works wonderfully. Too bad that the change will most likely be overwritten by Firefox updates :-/

Yep, it will indeed, sooner or later. A script is needed...

You could maybe remove the attribute from the page source using Greasemonkey. Should be more consistent than hacking files if it works.

A good idea. Hacking files HAS gotten burdensome...have to go learn greasemonkey though...

Unfortunately this solution doesn't work any more in FF 3.6.8 (with xulrunner-1.9.2.8pre) from https://launchpad.net/~ubuntu-mozilla-daily/+archive/ppa .

Yeah, you're right. I just tested by watching the fromhistory.sqlite database in my Firefox profile while doing various submissions with and without the fix applied. Boo. Looks like they've found a new way to handle this, or the function is no longer working the way it used to.

It worked fine on v3.6.16 Apr 2011...

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.