Quick Links

If you use the password manager built into your browser for remembering all your web logins, or are considering it in light of the recent events with LastPass, you have (or will) inevitably come across certain sites which simply will not allow you to save your password. However, with a simple click or two of your mouse, you can work around this limitation and force your browser to remember the password on these uncooperative sites.

Editor's Note: of course, if you're using LastPass, this functionality is built right in. This article is for those that prefer to use the built-in browser password saving instead of putting their passwords in the cloud.

Why won't some sites allow me to save the password?

This answer is quite simple, it is due to the "autocomplete" attribute on form and/or input elements being set to "off". This attribute was introduced by Internet Explorer 5 and does what its name suggests, prevents auto-complete functionality from applying to any field which has it explicitly turned off.

As you can see here on PayPal's site (which does not allow you to save your password), the login section has the autocomplete value set to off for the password field. As a result, the browser will not pick up this field for its auto-complete password database.

image

The Fix: A Simple JavaScript Function

Fortunately, the fix is equally as simple. We merely need to change the value of this attribute, wherever it is present, to "on". Thanks to the ability of JavaScript to manipulate the DOM (document object model), you can easily do this with the click of a bookmark.

The JavaScript function is embedded in the link below. You can either drag the link to your bookmark bar or right-click on it and bookmark the target link. Once this is done, simply clicking on the bookmark will run the "Allow Password Save" script on the current page.

If the link above doesn't work then here is the source for the link. You can create a bookmark with the following as it's source URL:

javascript:(function(){var%20ac,c,f,fa,fe,fea,x,y,z;ac="autocomplete";c=0;f=document.forms;for(x=0;x<f.length;x++){fa=f[x].attributes;for(y=0;y<fa.length;y++){if(fa[y].name.toLowerCase()==ac){fa[y].value="on";c++;}}fe=f[x].elements;for(y=0;y<fe.length;y++){fea=fe[y].attributes;for(z=0;z<fea.length;z++){if(fea[z].name.toLowerCase()==ac){fea[z].value="on";c++;}}}}alert("Enabled%20'"+ac+"'%20on%20"+c+"%20objects.");})();

From our testing (using PayPal as the test site), this worked as expected in Firefox 4 and in Internet Explorer 9. Unfortunately, we could not get it to work within Chrome despite the success message that autocomplete was enabled.

The procedures for using it are almost identical in each browser with Internet Explorer requiring one additional step.

Usage in Firefox

When you visit a site that does not allow you to save your password, run the "Allow Password Save" script. You should see a notification like the one below.

image

Enter your user name and password like normal and upon logging in, you will be prompted to save your password.

image

The next time you visit the page, your user name will be filled in automatically, but not the password. In order for the password to be auto-filled, you first have to put the focus in the user name field. You can use either a mouse click or Ctrl + Tab if the password field has focus.

image

Now when you move the focus from the user name field either with a click or Tab, your password will automatically fill in.

image

Usage in Internet Explorer

When you visit a site that does not allow you to save your password, run the "Allow Password Save" script. You should see a notification like the one below.

image

Enter your user name and password like normal and upon logging in, you will be prompted to save your password.

image

The next time you visit the page, your user name will be filled in automatically, but not the password. You will need to run the "Allow Password Save" script again and you should see the same notice as above.

image

In order for the password to be auto-filled, you first have to put the focus in the user name field. You can use either a mouse click or Ctrl + Tab if the password field has focus.

image

Now when you move the focus from the user name field either with a click or Tab, your password will automatically fill in.

image

JavaScript Source

If you are curious how the script works, here is the well formatted and commented source. Feel free to modify it as you see fit.

        <tt><pre>function() {
   var ac, c, f, fa, fe, fea, x, y, z;
   //ac = autocomplete constant (attribute to search for)
   //c = count of the number of times the autocomplete constant was found
   //f = all forms on the current page
   //fa = attibutes in the current form
   //fe = elements in the current form
   //fea = attibutes in the current form element
   //x,y,z = loop variables

   ac = "autocomplete";
   c = 0;
   f = document.forms;

   //cycle through each form
   for(x = 0; x < f.length; x++) {
      fa = f[x].attributes;
      //cycle through each attribute in the form
      for(y = 0; y < fa.length; y++) {
         //check for autocomplete in the form attribute
         if(fa[y].name.toLowerCase() == ac) {
            fa[y].value = "on";
            c++;
         }
      }

      fe = f[x].elements;
      //cycle through each element in the form
      for(y = 0; y < fe.length; y++) {
         fea = fe[y].attributes;
         //cycle through each attribute in the element
         for(z = 0; z < fea.length; z++) {
            //check for autocomplete in the element attribute
            if(fea[z].name.toLowerCase() == ac) {
               fea[z].value = "on";
               c++;
            }
         }
      }
   }

   alert("Enabled '" + ac + "' on " + c + " objects.");
}</pre></tt>