Skip to content

Instantly share code, notes, and snippets.

@Dulani
Forked from david0/strip-autocomplete.user.js
Created August 7, 2018 15:54
Show Gist options
  • Save Dulani/2d9e676d1bfab4893c30e12321189096 to your computer and use it in GitHub Desktop.
Save Dulani/2d9e676d1bfab4893c30e12321189096 to your computer and use it in GitHub Desktop.
Greasymonkey/Tampermonkey script that strips "autocomplete" attributes from username and password fields
// ==UserScript==
// @name Strip autocomplete attributes
// @namespace david0
// @version 0.1
// @description This plugin gives the control about your passwords back to your browser and allows the browser to store every password.
// @include http://*
// @include https://*
// @copyright 2014, David
// ==/UserScript==
function stripAutocomplete(element) {
element.removeAttribute("autocomplete");
}
function isUsernameOrPasswortField(element) {
return (element.type == 'password') || (element.name.indexOf('user') != -1);
}
var forms = document.getElementsByTagName('form');
for(var i=0; i<forms.length; i++)
stripAutocomplete(forms[i]);
var inputElements = document.getElementsByTagName('input');
for(var i=0; i<inputElements.length; i++)
if(isUsernameOrPasswortField(inputElements[i]))
stripAutocomplete(inputElements[i]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment