Force Firefox to save passwords even if the page disables autocomplete

The remember password feature in Firefox is a huge time saver. Of course, if you use it, you better be using the ‘Master password’ feature too which locks down all of your saved passwords with one password that you get asked for just once – the first time when Firefox tries to load a saved password after you start your browser.

Have you noticed that on some sites, Firefox will never give you the option to save your password? Some places where this happens is on Yahoo and Hotmail login screens and on corporate email sites. Ever wondered why this happens?

This happens because some sites explicitly prevent that from happening by using an “autocomplete=off” attribute in the form element for that page.

To override this, you can modify a script in Firefox –

  1. Close Firefox.
  2. Open nsLoginManager.js from C:\Program Files\Mozilla Firefox\components in a text editor like Notepad or NoteTab++.
  3. Search for “autocomplete” in this file and look for the code in the screen shot below.
  4. Change “off” to “XXX” and save the file.
  5. Done! Firefox will now ignore the autocomplete directive and you will be able to save passwords on more sites!

You may find other tips on the net which suggest commenting out the code in this method or to add code to return false from it. What is cool about my way is that the lines and offsets of all the code in that file stays the same. You just replace three characters with three different characters. This will make sure that if updates are applied to the file, there is no chance of it getting corrupted.

I tested this on Firefox 3.5 and it should work for sure on older 3.x versions as well.

Tags: , ,
This entry was posted on Friday, February 26th, 2010 at 12:05 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

18 Responses to “Force Firefox to save passwords even if the page disables autocomplete”

  1. Dhruv

    wow.. cool finding.. i always wanted to do this.
    nice stuff..! ๐Ÿ™‚

  2. ssssss

    Thank you very much! This always annoyed me, but I only thought just now to search for a solution.
    Works great!

  3. the mighty pickle

    How can I fix this same problem in IE8 ?
    (I have autocomplete turned on, but, as
    you said, some websites turn it off)

  4. Onkar Joshi

    I don’t know. Never tried.

    If you find out, please do add a comment here.

  5. Conor Cahill

    It looks like they have compiled the component javascripts in FF4 — this file no longer exists in the components directory (there’s now a browsercomps.dll which I presume is a compiled version of those same components that used to be individually available).

  6. Onkar Joshi

    Thanks for the update on that. I wonder if there is an easy way to do the same thing in FF4.

  7. Dave Tughan

    There is a plugin that allows you to create new passwords and edit old ones. It’s called the Saved Password Editor and can be dl’d from ( Full url if the form keeps it: ).

  8. igor

    Thanks for the article. I’ve been struggling to change this file within omni.jar for FF5+, but no luck.
    For FF6.0.2 I just exctracted omni.jar, deleted it and edited the file accordingly. Works fine!
    Drawback is that your FF will load 10ms slower ๐Ÿ™‚

  9. Onkar Joshi

    Nice! I think we can live with the 10ms delay. ๐Ÿ™‚

  10. anonymous

    DOES NOT WORK in Firefox 9.01 because there is no nonsLoginManager.js file in the “C:\Program Files (x86)\Mozilla Firefox\components” folder (FF9 installs in C:\Program Files (x86) instead of C:\Program Files.

  11. DUH


  12. John

    Found this page on a search to solve this issue. Would LOVE a solution that works with current Firefox 11.

  13. Brian

    Use Greasemonkey add-on for Firefox and one/both of these scripts (they auto install after Greasemonkey has been installed)

  14. Ondrej

    In FF11:

    Go to FF Program Files folder, there is a file called omni.ja, after doing backup, rename to .jar, open with 7zip/winrar/whatever, and inside you locate/change the file.

  15. gigel

    this does not work with gmail logins under firefox 12 beta
    i opened omni.ja, modified nsLoginManager.js BUT gmails’ login form does not have an “autocomplete=off” field in the html tag.
    you can look at it with firefox’ web developer tools, by right clicking on the username field and choose inspect element.

    does anyone know what is the workaround?


    this doesn’t work as of firefox 12

  17. Richard

    Had to jump over here because I couldn’t remember the file name to modify, for whatever reason it doesn’t always stick after an update. This does work on Pale Moon which for those that don’t know is an optimized version of Firefox. Running Pale Moon v15.2.1 which has the performance enhancements of F16 at this point. An option to consider!

  18. Richard

    Forgot to mention the file location in Pale Moon is C:\Program Files (x86)\Pale Moon\components\nsLoginManager.js, also there is a x64 version of “Pale Moon.”