Using Greasemonkey to disable Firefox autocomplete

Sometimes Firefox's textbox autocomplete gets in the way. WeBWorK is one example of where it's really annoying. With this Greasemonkey script, you can easily disable it on a page-by-page or site-by-site basis.

Just paste the following into a text document called "noautocomplete.user.js", and then drop it on Firefox (Sorry, if I remember, I'll make a downloadable version after I add attachments). You can then use Greasemonkey's interface to add "Included pages".

// ==UserScript==
// @name           Autocomplete Off
// @description    Lets you disable autocomplete on sites where it gets in the way
// @include        http://www.example.com/*
// ==/UserScript==
 
var inputElements = document.getElementsByTagName('input');
 
for (var i = 0; i < inputElements.length; i++)
{
  var el = inputElements[i];
  if (el.type != "text") continue;
  el.setAttribute("autocomplete", "off");
}

Trackback URL for this post:

http://www.constantthought.com/trackback/6