Search code examples
javascripthtmlfirefoxfirefox-addonfirefox-addon-sdk

Block "Would you like to remember this password ?" popup in firefox


i am creating a firefox addon using sdk and i would like to know if there is any way to block the "Would you like to remember this password ?" popup shown by firefox password manager when logging into a website. I have tried "autocomplete" attribute but it looks like firefox has stopped supporting it from version 30. It should not show up while logging in to a website. Please advice.


Solution

  • Add popupshowing event listener and if it's the id of the password baloon, do event.preventDefault(); event.stopPropagation() to stop it's showing.

    Or you can specifically target the baloon, by getting the id of it then attaching it like this:

    For example:

    var win = Services.wm.getMostRecentWindow('navigator:browser');
    var PUI = win.document.getElementById('i dont know the id');
    
    var previt = function(e) {
      e.preventDefault();
    }
    PUI.addEventListener('popupshowing', previt, false);
    

    This code attaches just to the most recent navigator browser window, you will want to iterate through all navigator browser windows, and also listen and attach to newly opened navigator:browser windows.