Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent web-browser auto-populating username/password field

Status
Not open for further replies.

dooley28

Programmer
Jan 3, 2008
23
IE
I have a problem with a web application Im working on.
When a user logs in, firefox will auto-populate the username and password, this is fine however on the "user edit" page if a user wishes to update their details, firefox will auto-populate the variables here too.

I haven't tested this on other browsers but if it doesn't work on Firefox I have a problem.

Is there a browser tag or some javascript function that will prevent browsers inserting this data. I was thinking possibly an onLoad() watcher that dumps whatever values on the div, but if there's a simpler route with PHP/HTML it would be very appreciated.

Thanks,
Doolety28
 
Hi

If the user not want the behavior, then why not the user disables it in his/her browser ?

Anyway, the old trick is to not let the browser recognize the [tt]form[/tt] fields. Depending on what the browser uses to identify the fields ( URL and/or [tt]form[/tt] [tt]name[/tt] and/or field [tt]name[/tt] ) add some randomly generated part to it.

Feherke.
 
there are php solutions to this issue. Essentially, as Feherke says, to randomise your form field names.

but from a simple perspective, just add
Code:
autocomplete="off"
to your <form> tag.

note that this is NOT html4 compliant but is supported by IE and FF. i believe it is in the html5 specification, however.
 
Thank you both for your responses,

My problem is my users will likely not know how to turn this stuff off in there browsers settings, so a server-side solution is nice.

For now I think I'll use the autcomplete=off for the moment and test how it goes, if needed I guess I could generate the input tags.

Again thanks for your help,
I couldn't find any solutions online for this!
 
how about googling 'disable web form autocomplete'?
 
How was I know to know the tag attribute was called autocomplete? With that knowledge I probably wouldn't have needed to ask.

Seemed more like an autofill, an autocompleter being the javascripty tool to produce a list of options based on what you type.
 
without being picky ...

googling "disable web form autofill" also turns up the answer on the first page of results.

i guess i was hinting that tek-tiips expects posters to have exhausted to a reasonable extent their private lines of enquiries (having regard to the requirement to be an IT professional) before posting on this board. In this vein, johnwm appends a link to this FAQ in his signature:
In the php forum we are considerably more lenient towards questioners than in other forums. Hopefully the fact that feherke and I both bothered to respond is evidence of this.

This post is intended to be constructive and not in any way a slight.
 
No problems,

I did do some (obviously somewhat)extensive searching and asked a couple of people. I think I may have had something like disable browser auto-enter in my search because I was finding it annoying/surprising that I came up with nothing. Now in my searches I find it difficult to not come up with the answer!

Anyway apologies for time-wasted and thanks again for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top