Created
March 3, 2014 15:26
-
-
Save david0/9327296 to your computer and use it in GitHub Desktop.
Greasymonkey/Tampermonkey script that strips "autocomplete" attributes from username and password fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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]); | |
Can't you just make a version that disables it for any form field, e.g., on this site https://www.anpdm.com/public/event/RegistrationForm/42475B407349405C427640 ?
That should happen if you remove line 28 I think. I don't remember why I limited it to password and input fields.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can't you just make a version that disables it for any form field, e.g., on this site https://www.anpdm.com/public/event/RegistrationForm/42475B407349405C427640 ?