简体   繁体   中英

Firefox displaying username and password in all my forms?

I have a website, and when I tell Firefox to remember my username and password for the website, it is causing the username and password to display in all forms on my website, such as registration form. It is only supposed to do this on the login form. Does anyone know a fix for this?

This is because you have given the form fields identical names, eg username/password. If you add this it will prevent the autofill:

<input type="text" autocomplete="off" name="foo" />

I was having the same problem with both firefox 3.6 and 5.0. Changing the field names did not prevent autocomplete, but autocomplete='off' did the trick(in both browsers). Thanks!

Give the login form's input elements a different name.

[FF] uses the usernamefield/password field values as hints to find the appropriate elements within a webpage by matching them to the "name" attribute.

https://wiki.mozilla.org/Firefox%3aPassword_Manager

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM